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

gcc not recognizing all C99 hex float constants


Hi,

I noticed, that even in C99 mode gcc doesn't recognize all hexadecimal
floating point constants.

Compile this with "gcc -std=c99":

  float f = 0x.9p0;

this gives the error
  ppnumber.c:1:11: invalid suffix "x.9p0" on integer constant

This is because cppexp.c:cpp_classify_number() only wants to go to base 16
(after it sees "0x"), if the following char is a hex digit (i.e. it
doesn't like the '.').

6.4.4.2 explicitely mentions, that for a 'hexadecimal-fractional-constant'
the initial 'hexadecimal-digit-sequence' before '.' is optional.


Ciao,
Michael.


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