[cfe-dev] Why is CharacterLiteral::getValue() unsigned?
clattner at apple.com
Mon Feb 16 10:45:29 CST 2009
On Feb 16, 2009, at 6:44 AM, Roberto Bagnara wrote:
> Am I misreading the C99 standard, 18.104.22.168#10, where it
> says "An integer character constant has type int"?
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. :)
More information about the cfe-dev