[cfe-dev] Patch for UCNs in string literals

Eli Friedman eli.friedman at gmail.com
Mon Jul 6 12:57:17 PDT 2009


On Mon, Jul 6, 2009 at 9:28 AM, Douglas Gregor<dgregor at apple.com> wrote:
>> The Unicode characters give me more pause (which I am looking to implement
>> for C++0x).  The C standard does not spell out a specific name for these
>> types, but defers them to uint_least_16/32_t.  However, I believe the string
>> literals are usable even when this header has not been included, and
>> obviously those typedefs might resolve to different types on different
>> platforms.
>
> We should know what uint_least16/32_t are from our target information, so we
> can just dig out that appropriate integral type. However, it's unfortunate
> that these types don't have a name that would be recognizable in
> diagnostics. (What's a character string of type const int*, anyway?) Smells
> like a design problem.

We have exactly the same problem for wchar_t.  And we can solve it in
exactly the same way: typedef the underlying type to something like
__wchar_t, and use the typedef for string literals.  It's not quite
ideal, but there's only so much we can do.

-Eli




More information about the cfe-dev mailing list