8

For example, Stack Overflow started with the rudimentary ISO standard . Then it evolved through /, /, , , and nowadays upcoming .

Suppose a user asks a question with no standard specific tag, but just the plain tag. Is it OK to answer that post with any of the existing standards without mentioning it?

8
  • 3
    I don't think this applies to just [c++] if I am honest. The fact the matter is you can either ask for clarification on the version the OP is using in the comments, or make an answer and either use code that is likely to work on all (supported) versions, or assume that they are sing the latest version. I, personally, in the [sql-server] tags assume the OP is using a fully supported version of SQL Server unless the OP denotes others (which right now, is only 2019. after 2017 went into Extended Support last month).
    – Thom A
    Nov 16, 2022 at 10:23
  • I agree with Larnu - it's the same thing for Java, or JavaScript, or C#, or Python, or most other languages. Also applies to libraries and other technologies. Usually there are constant changes and new versions produced. Most questions asked do not include a specific version of a technology, either. We somehow manage to live with that.
    – VLAZ
    Nov 16, 2022 at 10:34
  • 1
    Whenever I see a question that does not include the version I almost always attempt to answer the question in the most widely used version possible. But then expand the answer. E.g: if you're using Version X or above you could do this much simpler using bla bla, like so: some code
    – Lino
    Nov 16, 2022 at 10:44
  • 1
    According to the tag wiki, if there is no version specific tag, then it is assumed that the latest version is being asked about. For whatever that's worth. Nov 16, 2022 at 11:09
  • If it is an exercise derived from Kanetkar, they might expect a much older version. Do you have some examples? Nov 16, 2022 at 15:09
  • Re your edit: I wouldn't generalize the question to "library", as the answer would be quite different. Unlike the C++ language revisions, individual libraries may not be backwards compatible with their prior versions, which means that explicitly stating which version is being used in an answer is definitely preferable for such libraries. I would suggest removing the "library" part of this question.
    – cigien
    Nov 17, 2022 at 5:04
  • @cigien, some users have generalized in comments that this question applies to library as well. Besides it's true to an extent as C++'s standard library also changes much more than the language features with every revision. Same applies to other frameworks such as Qt as well.
    – iammilind
    Nov 17, 2022 at 8:52
  • Yes, I see that other users claim that the guidance can be applied more generally than just for C++ questions, but that would be an answer to your original question. I don't see why you need to change your question to match that. As it happens, I also disagree with the claim that this generalizes to other languages and frameworks/libraries. e.g. Python2 and Python3 aren't compatible, so it's definitely good to know which one is being used in an answer. Also, it's not exactly true that C++ (language/library) changes, i.e. things are added, but existing stuff works exactly the same way.
    – cigien
    Nov 17, 2022 at 8:57

2 Answers 2

15

Is it OK to answer the post with any of the existing standards

Yes.

... without mentioning it?

If the standard is relatively new, I would mention it in the answer. Because it is very possible that a person who tries your answer would have a compiler installed some time ago and hasn't updated it in the last month (or year).

For relatively old standards I see no need to mention them. But I guess no one will object if the standard will be stated in the answer.

E.g.:

  • C++23 - definitely mention in the answer.
  • C++20 - it is up to you.
  • C++17 and older - do not mention.
5

If a language version is fairly old but the language is backwards compatible with that version, then there is generally no problem with giving an answer for that version.

If your solution works on an older version but doesn't work on the latest version (perhaps because it uses a deprecated feature), then it may still be worth posting your answer, especially if the question is difficult to answer otherwise; but you should mention in the answer that it won't work in recent versions.

In some specific cases there may be a solution which works for some version of the language, and doesn't work for earlier versions, but doesn't obviously not work for earlier versions. A notable example is Python's dictionaries, which have preserved insertion order since CPython 3.6 and Python 3.7. Answers relying on that feature will not work for earlier versions of Python, but it's likely they will silently give a wrong result, instead of failing in a more obvious way. In that case, it's again worth mentioning about the language version in your answer.

You must log in to answer this question.

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