https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63337

            Bug ID: 63337
           Summary: Hexadecimal exponent: improvements to error message
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org

As discussed in the thread here:
  https://gcc.gnu.org/ml/gcc/2014-09/msg00282.html
if the user mistakenly tries to use the "e" suffix for a exponent marker with a
hexadecimal constant, the warning could be improved.

$ cat /tmp/foo.c
float f = 0x3ffe+63;

$ gcc/cc1 /tmp/foo.c 
/tmp/foo.c:1:11: error: invalid suffix "+63" on integer constant
 float f = 0x3ffe+63;
           ^

A better warning might be something like:
/tmp/foo.c:1:11: error: invalid suffix "+63" on integer constant
 float f = 0x3ffe+63;
           ^
/tmp/foo.c:1:11: hint: if you meant for "e" to be an exponent, use "p" as an
exponent suffix for hexadecimal constants:
 float f = 0x3ffe+63;
                ^
 float f = 0x3ffp+63;
                ^
or somesuch; maybe even just:
/tmp/foo.c:1:11: error: use "p" rather than "e" for exponents for hexadecimal
constants
 float f = 0x3ffe+63;
                ^
(how far can we go down the road of actually outputting a patch?)

Reply via email to