Re: programmatically determining if the machine is intel or not
Re: programmatically determining if the machine is intel or not
- Subject: Re: programmatically determining if the machine is intel or not
- From: Greg Hurrell <email@hidden>
- Date: Wed, 17 May 2006 15:00:34 +0200
El 17/05/2006, a las 14:35, Håkan Waara escribió:
That doesn't seem to be a runtime check; it only determines what
the person who compiled the code was running, right?
Well, no, in a Universal binary the code when run on an Intel machine
is equivalent to:
BOOL isIntel = YES;
if (isIntel)
// the compiler probably optimizes away all but the following line
NSLog(@"is Intel");
else
NSLog(@"is not Intel");
And on a PowerPC it is equivalent to:
BOOL isIntel = NO;
if (isIntel)
NSLog(@"is Intel");
else
// the compiler probably optimizes away all but the following line
NSLog(@"is not Intel");
So it's a compile-time check but it has a run-time effect. I imagine
that when running under Rosetta it "isIntel" will be NO. The API-
based suggestions already posted a no doubt better (in any case Apple
recommends against relying on the __i386__ and __ppc__ macros); this
was just a quick-and-dirty alternative.
Cheers,
Greg
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden