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.

Some compilers add extensions to C or C++. For example:

x ? : y

is a GNU C extension; the expression is equivalent to

x ? x : y

Another example is:

int array[] = { [0 ... 4] = 5, [5 ... 9] = 10 };

which allows ranges in designated initialisers for arrays, something that’s not allowed in ISO/IEC C99.

Clang/LLVM allows C programs to use blocks, a mechanism similar to closures/lambdas:

int (^someBlock)(void) = ^{ return 5; };

In all these cases, the extensions change the original language. A compiler must be aware of these extensions, otherwise they’re syntax errors.

Should questions about these extensions be tagged /?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

I think that if a question is purely covering the behavior of some specific extension, it would be nice to have the question tagged with the C implementation and / or compiler in question.

For instance, if you're asking about something that needs to have _GNU_SOURCE defined before being prototyped, adding would definitely make sense. This, of course in addition to tagging something that asks about GCC extensions.

The same would apply to Turbo / Borland C/C++, uclibc, dietlibc, or even tcc for example when mixing and matching compilers and standard implementations.

The whole point of a tag, for me is to make it easier for someone to really narrow down a search, and I think doing it that way makes sense. A lot of questions are tagged that way, but I'm sure some could use some additions.

share|improve this answer
    
This is the right answer. It is C, so that tag is valid, but also add the 'gcc' tag so the right experts are looking at it. (I'd guess there are very few compilers which don't have non-standard extensions...) –  AShelly Nov 17 '11 at 14:57
1  
I think it makes sense to be specific in tags when you know you're talking about an extension, or perhaps don't mind making use of one if an answer suggests it. I don't mean to say this sort of tagging should be obligatory, but I wouldn't mind it if people did it. –  Tim Post Nov 17 '11 at 14:59
    
Yes that's exactly what I meant. –  AShelly Nov 17 '11 at 15:02
    
The complication here is if it's an answer not a question it would seem inappropriate to change the tags on the question itself. E.g. question states "how can I do this?" (i.e. generic) answer is "with GCC you can do this easily using X, if you want to be portable you need to do Y" - the question doesn't preclude non-portable solutions and they may well be helpful, but retagging the question with every implementation in the world would also be wrong. meta.stackexchange.com/questions/14241/… is relevant perhaps. –  Flexo Nov 17 '11 at 16:14
    
@awoodland It should be up to the OP and future editors. I say future editors because some things do become part of the standard. Again, it's not an obligatory thing. However, I would not mind tagging in this way. It would also help to go back and find stuff that was tagged in this manner when the standards change. Still, just an idea. –  Tim Post Nov 17 '11 at 19:46

I'd say that in the cases of extensions that don't create new languages, tagging them under the original language makes sense.

share|improve this answer
    
Would you consider the examples above as being new languages? If so, how should they be tagged? –  Bavarious Nov 17 '11 at 8:54
2  
Formally, yes; the set of strings accepted by the parser is different. :-) Practically, no; people expect it to work like the main language states. –  Donal Fellows Nov 17 '11 at 10:59

Since it is an extension to C/C++ that some C/C++ compilers are able to handle, the question should be tagged with or .

This is similar to the extensions introduced in Objective-C from Apple compilers: Questions about those extensions are still tagged .

share|improve this answer

You must log in to answer this question.

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