[cfe-dev] Why is CharacterLiteral::getValue() unsigned?
Roberto Bagnara
bagnara at cs.unipr.it
Mon Feb 16 09:36:45 PST 2009
Chris Lattner wrote:
>
> 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. :)
To the contrary: I need to support that extension!
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it
More information about the cfe-dev
mailing list