#9 Unsafe to assume that __STDC__ is true if defined.

2.5.33
closed-rejected
John43
5
2006-03-05
2006-03-01
Anonymous
No

There are some checks for __STDC__ in the flex
source-code that assumes that if __STDC__ is defined,
it will be defined to a value returning true. This
works for GCC but might fail for other compilers, Sun
Studio is one example.

% cat test.c
main()
{
#if __STDC__
printf("__STDC__ is true\n");
#endif
#ifdef __STDC__
printf("__STDC__ is defined\n");
#endif
}
% cc test.c
% ./a.out
__STDC__ is defined
% gcc test.c
% ./a.out
__STDC__ is true
__STDC__ is defined
% cc -V
cc: Sun C 5.8 Patch 121015-01 2006/01/26

Discussion

  • Suggested fix.

     
  • John43
    John43
    2006-03-05

    • assigned_to: nobody --> john43
    • status: open --> closed-rejected
     
  • John43
    John43
    2006-03-05

    Logged In: YES
    user_id=335409

    __STDC__ is required to be 1. See section 6.10.8 of the C99
    standard.