Re: fshort-wchar
Re: fshort-wchar
- Subject: Re: fshort-wchar
- From: Anders Markussen <email@hidden>
- Date: Mon, 16 Apr 2012 15:37:14 +0200
On Apr 16, 2012, at 2:05 PM, Andreas Grosam wrote:
> 65535 seems odd.
>
> Could you please check if the result of the expression *a - *b is "unsigned int" as well when the types of the operators a and b are actually "unsigned short" ?
The result of the expression (*a-*b) is of type wchar_t in clang, and type (signed) int in gcc.
The type char_t is unsigned and 16 bits in both compilers.
> According C99 conversion rules, if a and b are "unsigned short", the expression should become effectively:
> (int)(*a) - (int)(*b)
>
> That is, the value of the expression (in your case) should equal -1.
There are rules for integral promotion in the C++ spec specifically for wchar_t.
- Anders
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden