|
|
Subscribe / Log in / New account

Looking forward to GCC 7

Looking forward to GCC 7

Posted Apr 13, 2017 8:30 UTC (Thu) by gowen (guest, #23914)
In reply to: Looking forward to GCC 7 by lsl
Parent article: Looking forward to GCC 7

If you want your "register" code to still compile, specify a -std=c++11 or something that predates C++17. How hard is that?


to post comments

Looking forward to GCC 7

Posted Apr 14, 2017 17:17 UTC (Fri) by lsl (subscriber, #86508) [Link] (3 responses)

Depending on the build system, it can be a bit annoying to specify per-source-file CXXFLAGS. Possibly more annoying than just removing the "register" specifiers.

My point is that it's rude to break backwards compatibility. Doubly so when you do it for dubious gain.

Looking forward to GCC 7

Posted Apr 17, 2017 0:10 UTC (Mon) by zlynx (guest, #2285) [Link] (2 responses)

If you aren't specifying a standard when you compile, you are taking whatever the default happens to be. If it breaks you get all the pieces.

You really should be specifying the standard level to the compiler. Anything else results in rude surprises, like when I had to go back and remove a bunch of C++14 code from a project at work to make it compile on older C++11 systems. If the standard had been set, that C++14 code wouldn't have been accepted in the first place.

And why would you want per source file CXXFLAGS? You'd set the -std=c++11 for all compile steps, not just some files.

Looking forward to GCC 7

Posted Apr 17, 2017 12:49 UTC (Mon) by mathstuf (subscriber, #69389) [Link]

Standard flags don't make sense as per-source, but if you have an optional backend which is only used in one file, limiting the -D flag to just that file can help minimize errant use of the flag and reduce the number of files to recompile when toggling the feature.

Looking forward to GCC 7

Posted Apr 18, 2017 20:01 UTC (Tue) by lsl (subscriber, #86508) [Link]

> And why would you want per source file CXXFLAGS? You'd set the -std=c++11 for all compile steps, not just some files.

The C++ program I occasionally work on (which is only used internally, so we don't have to worry about supporting older compilers) is built with -std=gnu++1[y4] and if there's a benefit to be had, it can be moved to (the GNU variant of) C++17. Sadly, that now also involves the patching of register-emitting code generators. Or maybe not, hoping that GCC won't implement this for GNU C++.

Anyway, pointless breakages like this hinder the adoption of new standards. Until recently, the C++ committee generally seemed pretty thorough in avoiding such gratuitous changes (as are most stewards of mature languages, lest they end up with a Python 3).


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds