Re: multi-character character constant and CFString
Re: multi-character character constant and CFString
- Subject: Re: multi-character character constant and CFString
- From: Eric Albert <email@hidden>
- Date: Tue, 26 Jul 2005 23:38:21 -0700
On Jul 26, 2005, at 10:58 PM, Chris Espinosa wrote:
On Jul 26, 2005, at 8:42 AM, Lawrence Gold wrote:
You can turn this warning off. In XCode, go to your target settings.
In the search box type "four character literals". Make sure it's
unchecked.
Another way to fix it, though it's kind of ugly, is to preface the
code with \0: Change 'JP' to '\0\0JP'.\
Ugly and not endian-safe. When you build for Intel you'll get 0x0000
in your short.
Better to use
short foo = *(short *)("JP")
Actually, you'll get 0x4a50 ('JP') in your short on both Intel and
PowerPC if you use '\0\0JP'. Multi-character constants are
native-endian values, so you'll always get the same value on all
platforms. The casting example above will result in 'JP' on PowerPC
but 'PJ' on Intel, which probably isn't what you want.
-Eric
_______________________________________________
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