help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glr2.cc compile errors under Windows


From: Jot Dot
Subject: Re: glr2.cc compile errors under Windows
Date: Sun, 21 Nov 2021 05:02:14 -0700 (MST)

>    53 #if defined __cplusplus
>    54 # define YY_CPLUSPLUS __cplusplus
>    55 #else
>    56 # define YY_CPLUSPLUS 199711L
>    57 #endif
> 
> Please check why your compiler does not define __cplusplus.  Compliant 
> compilers
> must define it properly so that we can know what version of C++17 we're in.
> See https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros.


It is defined. Just not what we think it should be. It is 199711L

I've never had to check the value of __cplusplus, just if it existed or not.
After some digging, I found this:

"You need to compile with the /Zc:__cplusplus switch to see the updated value
of the __cplusplus macro. We tried updating the macro by default and discovered
that a lot of code doesn’t compile correctly when we change the value of 
__cplusplus"

Source: 
https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/

Without this /Zc switch, the Microsoft compiler seems to default __cplusplus to 
199711L
This switch is not on by default.

I honestly can't find the words to express how I feel about this.

Sorry to bother you,
Thanks for your help



reply via email to

[Prev in Thread] Current Thread [Next in Thread]