Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: For what it's worth



I appreciate everyone's replies. New architecture requires new learning and I'm learning.

It occurred to me that the order of evaluation of arguments is not guaranteed; thanks for the reminder.

It was also a head slapper that the G$ and Intel chips are different endians. Again, thanks for the education.

The only thing I can say in defense of my own ignorance is that they worked when coded on the G4. At any raye I have fixed my errors.

Thanks

On Jan 26, 2008, at 12:47 AM, Charlie Dickman 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).

also

- (NSImageView *) imageViewFrom: (int) n, ... {
NSString *silverKey;
va_list ap;
va_start(ap, n);
switch (n) {
   case 1:
      silverKey = [NSString stringWithFormat: @"silverImageView%d", va_arg(ap, int)];
      break;
   case 2:
      silverKey = [NSString stringWithFormat: @"silverImageView%d%d"va_arg(ap, int), va_arg(ap, int)];
      break;
           default:
      va_end(ap);
      return nil;
}
va_end(ap);
NSImageView *silverImageView = [silverImageViews objectForKey: silverKey];
return silverImageView;
}

when invoked as

[self imageViewFrom: 2, 1, 10];

produces "silverImageView101" for the value of silverKey.
Using

   case 2: {
              int _1 = va_arg(ap, int);
              int _2 = va_arg(ap, int);
      silverKey = [NSString stringWithFormat@"silverImageView%d%d", _1, _2];
      break;
           } 

produces the expected result of "silverImageView110".

Charlie Dickman




Charlie Dickman



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden

References: 
 >For what it's worth (From: Charlie Dickman <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.