Re: CodeWarrior vs Xcode issues
Re: CodeWarrior vs Xcode issues
- Subject: Re: CodeWarrior vs Xcode issues
- From: "Andy O'Meara" <email@hidden>
- Date: Wed, 08 Jun 2005 11:09:50 -0400
On 6/8/05 4:48 AM, "MacArthur, Ian (SELEX) (UK)"
<email@hidden> wrote:
>
>> Your example isn't appropriate. How about this: try to come
>> up with *any*
>> way that the multi-char warning I demonstrated would be
>> useful in that it
>> uncovered an unintended side effect.
>
> Does that even work? Wow, I can't imagine ever even trying that...
>
> int n = 'xy';
>
> Is it endian-ness-safe? I mean, it actually gives the same effect on x86 and
> ppc? Blimey.
The short answer is yes, it's endianness safe--the only cause for warning,
as a couple people have pointed out, is that multi-char integers apparently
aren't in the C specification. The reason its endianness safe is that it's
just like any other inline integer--just think of it as base 256. When we
express an integer in hex, it's endianness safe--this is the same idea. The
only case of where a compiler wouldn't always treat leftmost digits as the
most significant that I've ever heard of is that Borland's compiler back in
the day apparently had a setting to byte-reverse character inlines (but this
was with an old version of the compiler--I'm not sure if it's even still
there).
Where are they used? On Mac OS, turn back the clock as far as you want to
go: OSType ('APPL', 'ttxt', etc). Where else? Suppose you have generic
messaging class--consider Powerplant's LBroadcaster and LLisener base
classes (are any base class where you're sending an integer around that is
used as a message ID). As long everyone names their message creatively,
there's plenty of namespace--the same idea was regarded for Mac OS file type
and creator codes (which I think was brilliant and ahead of its time, imho).
You get the readability of a short string but none of the overhead of one.
There's a site called http://folklore.org/index.py that has a collection of
stories from the guys who did the original mac stuff. If you flip through
there, you'll find the most interesting and ingenious stories about how they
delt with some of the limitations of the first Macs--it's insane. I feel
like a chump whenever I read a few of those stories.
Andy
_______________________________________________
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