Re: For what it's worth
Re: For what it's worth
- Subject: Re: For what it's worth
- From: "Clark Cox" <email@hidden>
- Date: Fri, 25 Jan 2008 22:14:46 -0800
On Jan 25, 2008 9:47 PM, Charlie Dickman <email@hidden> wrote:
> In moving projects from Xcode 2 on Tiger (G4) to Xcode 3 on Leopard (Intel)
> I have found two cases of code (Objective C) that breaks in Xcode 3 on
> Leopard (Intel) that works perfectly fine in Xcode 2 on Tiger (G4)...
>
> unsigned u = '\1\0\0\0';
> u >>= 8;
>
> results in u equal to '\0\1\0\0' in Xcode 2 on Tiger (G4) but results in
> '\1\1\0\0' in Xcode 3 on Leopard (Intel).
I'm not seeing this on my machine.
> silverKey = [NSString stringWithFormat: @"silverImageView%d%d",
> va_arg(ap, int), va_arg(ap, int)];
vs.
> int _1 = va_arg(ap, int);
> int _2 = va_arg(ap, int);
> silverKey = [NSString stringWithFormat: @"silverImageView%d%d", _1,
> _2];
That's a bug in your code. The first is the wrong way to do it, and
the second is the right way. You could never rely on the order in
which parameters are evaluated. The same is true of regular C
functions:
int foo();
int bar();
int baz();
...
foo(bar(), baz());
You have no guarantee that bar() gets called before baz().
--
Clark S. Cox III
email@hidden
_______________________________________________
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