Hacker News new | ask | show | jobs
by CJefferson 4794 days ago
Is the implication that other teams are better with standards compliance?

Here is a much, much more serious issue. Variable length arrays of C++ types. Totally not in the C++ standard anywhere. Accepted by g++ and clang++, even if I turn on all warnings, and use '-std=c++11', which is supposed to turn off extensions. I have to add -pedantic to finally get a warning.

Now, I'm not saying they should break this code, but this is a much, much, much more serious unlabelled breakage of the standard, which is never going to get fixed, and goes back to the start of g++ and clang++.

    struct X {};

    int main(int argc, char** argv)
    { X a[argc]; }
3 comments

Dynamic arrays will be in C++14.

http://isocpp.org/blog/2013/04/trip-report-iso-c-spring-2013...

That being said, you are correct that it would be good to see warnings in something other than just -pedantic for that.

--std=c++11 is not supposed to turn off all extensions, only the extensions that conflict with the standard. The VLA extension only applies to programs that would be malformed according to the standard, so it isn't turned off with -std=c++11. The -pedantic flag is for adhering to the standard exactly.
Standards nonconformance has always been less of a problem when gcc does it.

(Of course, part of that is presumably that gcc's nonconformance is generally useful, as in this case...)

FOSS developers like to forget that GCC is also full of language extensions and nonconformance issues.

This is pretty standard type of issues for any ANSI/ISO language regardless of the vendor.

Oh boy the joys of doing C and C++ development across multiple OS in the late 90's with commercial compilers.

Gcc was pretty wild-n-wooly back in the '90s, and seemed to add language extensions left and right, but that attitude changed quite a while ago, and it's very good about standards conformance these days (part of the reason for this, of course is it's no longer so necessary: many of these extensions have picked up by the standard in one form or another).

In my experience, gcc is also significantly better with standards conformance than VC++, either with default settings or with strict warning/conformance options turned on. [I was on a team doing shared g++/vc++ develeopment, and it fell to me to fix all the code checked in by devs using non-standard VC++ extensions... way, way, way too much time... >< ]

The example given in the "story" is useful.
Not terribly - you can get the same effect with `return Thing()'. This doesn't seem as useful as the similar bug/extension that allows pre-C11 scoped enums (see, e.g., http://stackoverflow.com/questions/441552/scope-resolution-o...).