What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

There are a whole bunch of questions about whether you can declare multiple variables of different types in a for-loop initializer:

Clearly the C questions (resp. C++ questions) should be duped together.

Now C and C++ are quite distinct languages. However, in this case, the questions are all asking about a feature of C (technically C99) syntax that (I think) was taken unchanged into C++. Here, any answer to the C question will equally apply to the C++ one. So should these be duped into a single question for both C and C++ here?

Related: Should we close VB.NET questions as duplicates of C# questions and likewise? 's accepted answer is that a question about .NET framework features common to 2 languages warrant closing as a duplicate.

share|improve this question
2  
Check carefully that the feature are the same between the 2 languages, and whether the thing being asked in the question doesn't depend on a difference between 2 languages. There are some small difference between the 2 language that makes the answer right or wrong (particularly UB for certain expression i = i++). –  nhahtdh Aug 17 '12 at 5:28
    
@nhahtdh: In general that's true, but I don't think C++ extends the syntax for variable declarations in this case. –  Mechanical snail Aug 17 '12 at 5:29
    
You are probably right. I haven't checked the standard, but it is likely that there is no difference here. –  nhahtdh Aug 17 '12 at 5:32

2 Answers 2

up vote 2 down vote accepted

No. Questions must not be marked as duplicates if they would have different answer. C and C++ may have the same feature now, but a good C answer would point out compatibility issues with older compilers, and a good C++ answer would point out different compatibility issues with older compilers.

Furthermore, while the C questions are about related topics, none of the three is a duplicate of any other. I won't venture to judge the C++ questions but they don't all look like duplicates of each other either.

share|improve this answer

There are some criteria for me:

  1. Are they the same language or nearly the same? (for in C and C++ declarations are the same if for example, don't use std::safe_pointer)
  2. Do they cover the same area? (Your first two both covered for loops, but the problem was in different areas of it)
share|improve this answer
    
Right. The first one has problem in the condition part. The others are mostly about the initialization part. –  nhahtdh Aug 17 '12 at 5:38
    
That's my mistake; the very first one isn't a duplicate. Edited (and added some more dupes) –  Mechanical snail Aug 17 '12 at 5:53

You must log in to answer this question.

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