This is the mail archive of the 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]

Re: cpplib: Language defaults

On Sat, 18 Nov 2000, Neil Booth wrote:

> 1) __STRICT_ANSI__ was only being set for C89 and C94.  Surely this
>   should be done for C99 too?  Assuming it should, I've fixed this
>   below.

It should indeed be done for C99.

[ While it's probably a specs issue rather than a preprocessor one, I'd
like someone to look at c/545 - -std=c89 and -std=c99 define the
non-conforming macro "i386" but -ansi doesn't. ]

> 2) There is no definition of __STDC_VERSION__ for C89 or GNU89.  There
>    is for C94, C99 and GNU99.  I've left this as it is.

Correct - __STDC_VERSION__ was introduced in AMD1.

> 3) Whereas it seems we default to GNU89 if not told otherwise, GNU89
>    sets the C89 flag to 1.  We were not doing this by default before.
>    I've "fixed" this below.

It seems to me that the C89 flag gets used to control aspects of lexing
(e.g. hexadecimal floating point constants) where strict C89 is
incompatible with extensions that should be accepted in GNU89 mode.  That
is, C99 hex floats are a documented extension in GNU89 mode but mustn't be
accepted in strict C89 mode because they (or at least the changed from C89
definition of preprocessing numbers they imply) change the interpretation
of conforming code (see gcc.dg/c9[09]-hexfloat-2.c).

Joseph S. Myers

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