On Tue, 1 Oct 2019 at 16:36, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > > On Tue, 1 Oct 2019 at 15:59, Edward Diener > <eldlistmailingz@xxxxxxxxxxxxxx> wrote: > > > > On 10/1/2019 7:13 AM, Jonathan Wakely wrote: > > > On Tue, 1 Oct 2019 at 01:25, Edward Diener wrote: > > >> How do I find out, for a given gcc compiler product such as gcc-9.2, > > >> what the gnu extensions are when I specify '-std=c++nn' and when I > > >> specify '-std=gnu++nn' for any given valid 'nn' ? When I look in the > > >> documentation for '-std' in gcc-9.2 the only explanation I can see at > > >> https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/C-Dialect-Options.html#C-Dialect-Options > > >> does not give me that information. Does it exist somewhere online or in > > >> the gcc docs ? > > > > > > The documented extensions (and when they are enabled) are covered in > > > https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/#toc-Extensions-to-the-C-Language-Family > > > and https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/#toc-Extensions-to-the-C_002b_002b-Language > > > (or just search for "extensions" in the TOC). > > > > > > > Thanks for the links. But I am trying to understand the difference > > between, let's say, '-std=c++17' and '-std=gnu++17'. Clearly they can > > not be offering the exact same gnu extensions, else there would not be > > two different settings for the C++ standard 2017 in gcc. > > Wrong. They could enable exactly the same set of extensions. It would > be confusing and annoying to users to *not* provide a -std=gnu++17 > option given that we have -std=c++NN and -std=gnu++NN for every > previous standard. So it's wrong to assume "clearly" they can't mean > the same thing. > > > You have said > > that '-std=c++17' is not necessarily just the C++17 standard but may > > also include some gnu extensions. So the gnu extensions included in > > '-std=c++17' must be different than the gnu extensions included in > > '-std=gnu++17'. > > No, as above. > > > How is it possible to find out the difference in gnu > > extensions between the two ? Is there any documentation that explains > > that difference, or is it left for the programmer to experiment and see > > what is there in each case ? > > Read the manual sections I linked to. For each extension, if it > conflicts with the base standard it will only be enabled for the > gnu++NN modes, not the c++NN modes, and should be documented as such. > > I'm not going to do reading that for you. There are also Standard Library extensions. The -std=c++NN options cause the __STRICT_ANSI__ macro to be defined, and certain Standard Library extensions will be disabled when __STRICT_ANSI__ is enabled (for example, is_floating_point<__float128>::value is true for gnu++NN modes and false for strict modes). You can find those differences by grepping the headers.