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

Zack Weinberg <zackw at panix dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zackw at panix dot com

--- Comment #14 from Zack Weinberg <zackw at panix dot com> ---
I think we should reopen this bug and treat it as a request to improve the
diagnostics.

GCC is correct to reject tokens of the form "0x000E-0x0001", but the
accumulation of duplicate bug reports suggests that we could do a better job of
explaining what is wrong.  Proposal: whenever we are about to issue the
"invalid suffix on (integer/floating) constant" error, if the first character
of the "invalid suffix" is + or -, we say instead something like

    error: invalid numeric constant "<entire pp-number token>"
    note: ('+'/'-') after ('e'/'p'/'E'/'P') continues a pp-number
    note: to perform (addition/subtraction), put a space before the ('+'/'-')

Printing the entire pp-number token instead of just the "suffix", mentioning
the standardese term "pp-number", and calling the token an "invalid numeric
constant" instead of an "invalid integer/floating constant" should clue people
in to _why_ this apparently perverse tokenization is happening.

Reply via email to