Just recently I tried to edit two questions on SO that were explicitly Tagged 'C++' that did not have any C++ in the code they posted with their question. As I did not save a link to the first one here is the second one. The other was even more clearly C, for every #include statement went something like this #include <something.h>. Aside from the languages obvious overlap, and the fact that you can readily code them together, they are different. Not to mention, this example and the other have no instances of crossing the two!

What, if anything, can be benefited from an individual to ask a question that is clearly C and, knowingly or not, pass it off as C++ just to have other users give advice based on the Tag(see example) which they probably can't understand. It is also allowing pages to be wrongly searched or hidden from those who are trying to get explicit C or C++ advice.

I think when a peer check occurs on these questions regarding C/C++ they should at least add the other Tag and accept the edit. It seems like that would benefit everyone.

  • 1
    The suggested edits: stackoverflow.com/suggested-edits/341883 and stackoverflow.com/suggested-edits/329848 - Roberto, you can get a link to those from your profile, Activity tab, Suggestions filter.
    – Mat
    Aug 6, 2012 at 11:17
  • 4
    If the user believes he is writing C++ code, and it is valid code, then let him do that. Some C++ courses start out by teaching pointers and arrays before getting to vectors and iostreams. We can't help that.
    – Bo Persson
    Aug 6, 2012 at 11:20
  • @Bo Persson-Wow, no offence, I can't see any reason to do that. We're not talking about a child and the Easter Bunny? I've been in algo classes that teach enough C++ to make you dangerous, and C++ classes where you use C almost the entire course(?)! That never made me want to interchange the two languages. In fact, that made me appreciate the difference. Now, if you want to understand the difference and use printf because you like the formatting technique, then I'd agree; why not? But come on, label the question correctly, that's all! Aug 6, 2012 at 11:30
  • 1
    Which you could simply have kindly pointed out to the OP. They might not be aware of the difference. Yes, that does happen unfortunately. I've only seen it happen far too often that C++ courses end up being taught as classes stuck onto C. :(
    – Bart
    Aug 6, 2012 at 11:32
  • @Bart-You're right. Aug 6, 2012 at 11:33
  • I'm just saying that if the user is attending a C++ course, there is some logic for him to tag his questions with C++. Doing so will likely also attract some answers that use std::string or std::vector, which doesn't happen with a C tag.
    – Bo Persson
    Aug 6, 2012 at 11:36
  • @BoPersson-I'm sure you're right too. I hate to think that students aren't being told what they're using. Aug 6, 2012 at 11:40

3 Answers 3


Yes, you seem to be correct that the question uses C rather than C++. However, looking at your suggested edit, all you have done is change the tag. The question still says C++ everywhere. What's more, there are several other issues which should be addressed.

For example:

  • 'i' should be 'I'
  • "thanks" should be removed
  • Ideally a "tag" should not be part of the title. Certainly not at the beginning
  • If you retag it , don't let the question state C++

All in all your edit is far too minor. If I would have evaluated it, I would have rejected it as "too minor" as well.

Moral of the story: if you correct one issue, make sure you don't leave (a significant number of) other issues uncorrected.

  • So, with this example, the right thing to do is to edit his code to reflect C++? Aug 6, 2012 at 11:20
  • 5
    No. Never ever edit code in a question. Rather than simply retagging, you could have pointed out to the OP that it seems to be C rather than C++. Which (as Bo points out) might not be the OP's fault.
    – Bart
    Aug 6, 2012 at 11:22
  • No! Don't change code in questions. If you're going to make an edit, try to fix all that's fixable. Don't just make one little change when there are lots of other things to correct. The title on that one was a very obvious thing to fix.
    – Mat
    Aug 6, 2012 at 11:23
  • Refrain from changing the code in the question, except for: indentation that doesn't change the meaning of the code, OR after clarification with the OP, and the OP identify that the error in the code is typo, and the typo doesn't exist in the OP's version of the code.
    – nhahtdh
    Aug 6, 2012 at 11:26
  • Thanks everyone. @Matt- should I say duh now? Aug 6, 2012 at 11:31
  • 1
    Other common issues: code formatting, improve readability using lists, correct punctuation mistakes, add newlines to form paragraphs, use correct text as anchor for links, fix dead links. Aug 6, 2012 at 12:17

A language tag defines what language the user is using, not what language random people think he's using. It is very possible to write code that compiles as both C and C++; therefore, it is up to the OP to decide which one applies.

I personally consider it very rude to change the OP's choice in this matter. To impose your own ideas of what constitutes C++ and what does not.

C++ is all of the C semi-subset as well. Code that only uses the intersection of the two language is no less C++ than code that doesn't. It is not your place to decide that the C++ tag can only be used for code that is sufficiently C++ by some arbitrary metric.

If the code follows (or attempts to follow) the ISO Standard for Programming Language C++, then that question deserves to have the C++ tag.

  • I understand that "C++ is all of the C semi-subset" as I alluded to in my post. If indeed the case is that he is using them in an "intersecting" manner then it should be stated as such(IMHO) and tagged with both. I think if you go to the link, if it hasn't been further edited, that you will see in no way was this the case. I've seen countless examples of people with high reputations dog people out, close questions AND edit tags for such things. In order to get the best advise you'd think the OP would want to let you know where the question is coming from and most users seem to expect it. Aug 6, 2012 at 20:17
  • @Roberto: I've seen high-rep users do plenty of things I don't agree with. I've done things that other high-rep users don't agree with. If you don't have the rep to freely edit, then you have to accept that the community is going to use their standards to judge your edits, not your own. Aug 6, 2012 at 22:46

The user could tag a question with , even if the code shown in the question is C.
Consider, for example, a question where a user wants to know how to write a better C++ version of code written in C (let's not consider if this is an acceptable question, or not). I would expect the question be tagged , and not , as the question is asked to users who knows C++, not to those users who knows C.

So, the assumption that the tag must always reflect the programming language used for the code shown in the question is wrong.

  • I understand the many cases why you would add a tag that is totally not relevant to the language posted, like in your example. The problem I have with these answers that give general reasons for things, is it's not the case. I wouldn't want or try to edit a tag in your example. But the OP should say something in the extended post like; "I'm new to C++, here is some C code I wrote and would like some advice how to code it strictly C++". If you read my post and follow the link you'll see my basis for the edit wasn't purely tag/language issues. If something's expected state it, saves time. Aug 6, 2012 at 20:30
  • It's not necessary the user says "I am new to C++, and this is some C code." Apart from programming language tag, I would probably remove drupal-views if the question is generic enough not to be about the Drupal Views module, and the user doesn't say "How can I achieve this with the Views module?" But that would not be a case of replacing a programming language tag with another.
    – apaderno
    Aug 6, 2012 at 20:50
  • I was quoting inline with the post I was referencing. I realize not everyone would have to claim to be new in order to get advice, but don't you think they should be as clear as possible and point it out. I can't see me asking a question like your example and not stating it. See this. OP could have used both considering he ended up liking the answer which references sprintf, a capability of C++ derived from C, which likes C strings not strings which is what he asked for help with. Aug 6, 2012 at 21:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .