22

Question1 is about if-if statements vs if-else if statements in C#. And question2 is asking the same thing, but in C/C++, which was answered perfectly, meanwhile the answer is also suitable for question1. Should the C# question be marked as a duplicate of the C/C++ even though they are different languages?

1
  • 11
    In my view, in general, different languages may have different features and restrictions to solve the problem, while 2 questions may have same answers occasionally, it does't imply they are asking or requiring the same thing. Also I see the question is about optimization, which is quite language specific, marking them as duplicate may mislead beginners.
    – ggrr
    Commented Mar 23, 2016 at 2:58

1 Answer 1

36

I'd leave them separate, per language. If you can find a C# dupe, then use that one.

At first glance, the answers in the current thread are similar to the c/c++ question, which are also similar to this java/c++ question and probably others too.

On the one hand, multiple if statements vs an if/else structure is a question about logic, and isn't necessarily dependent on a particular language, at least at first.

But then there's a comment like this in the java/c++ question, regarding whether there's any difference:

It's a significant difference, because you can implement operator== in C++ to do nasty (side-effecty) things (which has also an influence on optimisation ...). AFAICR this doesn't work in Java.

If there are language-dependent considerations (like the above), based on the particular language the OP is asking about, they're not exact dupes.

Also, it may confuse/mislead people who are seeking answers about one language, to then be forwarded to a thread with examples and notes about a separate language.

1
  • 4
    TL;dr: it sets a bad precedent.
    – Braiam
    Commented Mar 24, 2016 at 16:22

You must log in to answer this question.

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