This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using __STDC_VERSION__ macro


On 1 February 2017 at 13:49, Mason wrote:
> Hello,
>
> https://gcc.gnu.org/gcc-5/porting_to.html states
>
> "Typically, this macro is used as in the following:
>
>   #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
>     /* ... */
>   #else
>   # include <stdint.h>
>   #endif
> "
>
> I think it is unnecessary to test for the existence of __STDC_VERSION__
> because N1256 6.10.1p4 states
> "all remaining identifiers [...] are replaced with the pp-number 0"
>
> Therefore
> #if __STDC_VERSION__ < 199901L
> would work as expected, even when __STDC_VERSION__ is undefined.
> (As the constant-expression would be false.)


But you'd get a warning with -Wundef


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]