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]
Other format: [Raw text]

[C++11] Reclaiming fixed-point suffixes for user-defined literals.


Now that C++11 user-defined literals are in trunk I was thinking about reclaiming some of the numeric suffixes that are currently recognized by gcc in the preprocessor.  The C++11 spec stipulates that any suffix that is recognized by the implementation is not allowable as a user-defined literal suffix in c++.  This prevents C++ from hijacking 123LL, 1.234L, etc.  On the other hand, there are several numeric literal suffixes that are recognized and used as gnu extensions.

One class of suffixes stands out in this connection: fixed-point literals.  These end in 'k' or 'r' and can optionally be unsigned by starting with 'u' and optionally have a size 'h', 'l', 'll'.  The difference for these suffixes is that fixed-point literals are explicitly rejected by the c++ front end.  Attempts to use such literals:
int i= 1.23k;
results in 'error: fixed-point types not supported in C++'.

So I ask the question:  Should I make a simple change to libcpp to allow fixed-point literal suffixes to pass to the user-defined literal code in c++11 mode?


Ed Smith-Rowland

P.S. There are other suffixes that might be reclaimed as well such as 'i', 'I', 'j', 'J' for complex integral or floating point imaginary numbers and others.  These might be more difficult or impossible to reclaim for C++11 because these might be allowed and used in gnu-C++ and it might break existing code.

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