[cfe-dev] hexfloats in c++0x

Johannes Schaub (litb) schaub.johannes at googlemail.com
Thu Feb 10 11:22:18 PST 2011

Douglas Gregor wrote:

> On Jan 29, 2011, at 10:01 PM, Johannes Schaub (litb) wrote:
>> Douglas Gregor wrote:
>>> On Jan 27, 2011, at 10:50 AM, Howard Hinnant wrote:
>>>> Can we turn on support for hexfloats in -std=c++0x?  It is already
>>>> turned on in c++03 mode.
>>>> get_double.pass.cpp:108:14: error: invalid suffix 'p' on integer
>>>> constant
>>>>       assert(v == 0x125p-1);
>>>>       ^
>>> They're disabled in C++0x mode because they conflict with user-defined
>>> literals. We might be able to jump through some hoops to see if there's
>>> a literal operator named "p" or "P" in scope, but... yuck.
>>> Suggestions welcome!
>> I think that behavior is undefined for any program that uses a literal
>> suffix without a leading underscore, because those names are reserved for
>> use by a further Standard.
> The *library* reserves those names, not the language. The language is
> perfectly happy to allow operator ""p, and that's where the conflict with
> C99 comes up.

Why does this only apply to programs that use the library and the following 
does not? Clang rejects it, without the program using the standard library.

    int __clang__ = 0;

The restriction is also stated as a subclause of Is the "always 
reserved", which is used for reserving __foo and _Foo, intended to break out 
of the implicit assumption governing all of that says the 
restrictions only apply to programs using the facilities of the standard 

More information about the cfe-dev mailing list