23

I posted What is the standard compliant way to convert a signed integral value to a sortable, unsigned in C++?

And the tags were removed in an edit, but I reverted because I wanted a standards-related answer related to undefined behaviour (that tag was also removed).

I would like this question to be correctly tagged, so I'm coming here. Thoughts?

2
  • 3
    meta.stackoverflow.com/questions/265844/… (I don't see your question as version-specific.) Commented Nov 6, 2015 at 15:31
  • 3
    "I don't understand why this occurred, and I'd like to do things correctly whenever possible, so I came here for help" seems like a pretty reasonable question to me. I wonder why you got a downvote? Commented Nov 6, 2015 at 23:23

1 Answer 1

32

The tag to use when you specifically want to get an answer based on strictly the C++ standard (any version) rather than current implementations is [language-lawyer].

The [c++11] and [c++14] tags make sense if and only if you want an answer that specifically covers these and only these versions of the standard. Without those tags, answerers should already take into account the fact that the current C++ standard is C++14, but may also cover C++11, C++03 and C++98 in their answers.

It makes sense to me to remove the language version tags.

As for the [undefined-behavior] tag, that doesn't seem to me to apply to your question. I would think that that is more relevant for questions that cover a specific result of undefined behaviour, whereas your question is about getting a valid C++ answer, which already implies no undefined behaviour without the need for a tag.

15
  • edited as per your suggestions, thank you Commented Nov 6, 2015 at 15:48
  • 2
    Why does language-lawyer exist? Isn't that a meta-tag?
    – Joe
    Commented Nov 6, 2015 at 19:31
  • 8
    @Joe See Is language-lawyer really an effective characterization, or a borderline meta-tag?
    – user743382
    Commented Nov 6, 2015 at 20:18
  • 7
    @Joe: Yes, but an exceptionally valuable one. Commented Nov 6, 2015 at 21:44
  • "...questions that cover a specific result of undefined behaviour..." Have you actually ever had any luck asking questions of this sort? I find the C++ community here wildly opposed to the idea of even considering what actually happens when a program triggers undefined behavior. Commented Nov 6, 2015 at 22:18
  • @KyleStrand I don't remember seeing such questions at all recently and haven't ever asked them myself in the past, but I have no problem with such questions and if I see one that's well-asked, interesting and unanswered, I will try to answer it.
    – user743382
    Commented Nov 6, 2015 at 22:56
  • @hvd That's very good to know! I don't know if you'll think it meets your criteria (there is an answer, though I'm not sure it's correct), but one such question I've asked is here. (Note that the first several comments primarily consist of objections to my attempt to figure this out.) Commented Nov 6, 2015 at 23:23
  • 1
    @KyleStrand I think it'll be hard to get an answer for it, sorry. If clang and GCC don't act on the UB, then no one will be able to answer that authoritatively without a deep analysis of the compilers' source code, or documentation somewhere that the compilers officially support this as an extension. I don't expect such documentation to exist, and analysing even one C++ compiler is probably too much to expect from an answerer, let alone six separate versions. If clang or GCC does act on the UB, a short example could make for an interesting answer, but I have no such example.
    – user743382
    Commented Nov 6, 2015 at 23:32
  • Well, thanks for taking a look :) Commented Nov 6, 2015 at 23:39
  • @KyleStrand it is very hard to ask those kinds of questions well, one of the few times I was able to provide a solid explanation for UB was because it was well documented already by John Regehr who does a lot of research in this area. Another similar case such as Linux null pointer check removal is also well documented. Otherwise you would have to know what exactly the compiler is doing. It is a fascinating subject but hard to get good answers to. Commented Nov 7, 2015 at 1:15
  • 2
    @KyleStrand also as hvd says, how gcc and clang exploit UB can vary greatly over versions. Commented Nov 7, 2015 at 1:17
  • @ShafikYaghmour That link seems to indicate that Clang doesn't ever treat UB differently from version to version. Every column in the Clang table is identical. Commented Nov 7, 2015 at 15:32
  • Though of course he's testing a very small subset of UBs, and it's not clear whether the way in which Clang "takes advantage of" each instance remains consistent from version to version. Commented Nov 7, 2015 at 15:37
  • 2
    @Joe By the "Can someone be an expert in that topic?" test, language-lawyer is appropriate for an expert in the topic of fine points of standard interpretation. Commented Nov 7, 2015 at 19:42
  • @KyleStrand yes, that is likely to do w/ clang being much younger also the fact that Chris Lattner says that UB are land mines just waiting to explode gives me little comfort it will remain consistent. Commented Nov 8, 2015 at 0:48

You must log in to answer this question.

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