[cfe-dev] Why is CharacterLiteral::getValue() unsigned?
Chris Lattner
clattner at apple.com
Mon Feb 16 08:45:29 PST 2009
On Feb 16, 2009, at 6:44 AM, Roberto Bagnara wrote:
>
> Am I misreading the C99 standard, 6.4.4.4#10, where it
> says "An integer character constant has type int"?
> Thanks,
The type of the literal and the type of getValue() are not necessarily
tied. This just means that the value zero extends when you ask for
it. If you cast it back to char, you can get whatever you want.
To answer your specific question, the reason for this is that clang
supports the "multibyte char" extension, which looks like 'abcd'. Yes
this is a horrible thing. :)
-Chris
More information about the cfe-dev
mailing list