I come across many c++ asked/tagged questions for which there already exists many duplicate posts but sometimes those posts are tagged with only c.
For example, suppose a user asks a C++ tagged question saying ternary operator does not work with the following code:
cout << endl;
(afterCalc)? goto calcStart : continue;
Now the above is clearly a C++ question (as it uses cout
). Now after searching for duplicates I came across many posts and 2 of them were tagged only c and the solutions/explanations provided there are applicable to this post also. Here are the duplicates that are only c tagged:
goto not working with ?: operator in C
Can I use a continue statement in a ternary operator ? (C)
Now, my question is, can this post (the one I showed as an example) be closed as a duplicate of the two posts that are only C
tagged.
Note that the tag wiki says:
Code that works the same in both languages should be tagged C unless the OP explicitly says that they are compiling it with a C++ compiler, in which case it should be tagged C++ and not C. It's all in the tag wiki.
(emphasis mine)
So as per my understanding since the code works the same in both languages, by definition it should be possible to close the post as a duplicate of the posts tagged only c. That is, as long as the solution and the problem applies to both the languages and the concerned problem can be solved by them, one should be able to closed as a duplicate of the other.
cout
)." I question the "clearly". Clearly it's a question which has C++ code, but that doesn't mean it's a question about C++. If instead ofcout ...
it hadfrancescalus_super_lib_call()
would the question suddenly be about the library I wrote last night?cout
will work with a C++ compiler. That is why this example question can't be taggedc
. In particular because a c compiler will reject the code.cout << 0.1+0.2 // Why not 0.3??? :*
is automatically a question which is uniquely answerable in the C++ domain.