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]

Re: Proposal


<<You should investigate the rules for numeric syntax in languages
which already have this notation, such as Ada and Perl.
>>

In Ada, underscores can only be used to separate digits, and the extension
is thus a simple one from a syntactic definition point of view. The actual
excerpt from the Ada grammar is as follows:

2   decimal_literal ::= numeral [.numeral] [exponent]

3   numeral ::= digit {[underline] digit}

4   exponent ::= E [+] numeral | E - numeral

I don't see any language or definition issue in introducing exactly this
same restricted form into C


       16777216_UL
       16777216U_L
       0._1234
       0x_1234
       12.34_e+56
       12.34e_+56

All these should be illegal if the above approach is followed, and I think
that is the right choice. The only legitimate use of the underscore is to
separate digits in a long sequence of digits.


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