Sending messages to nil on Intel
Sending messages to nil on Intel
- Subject: Sending messages to nil on Intel
- From: Felix Schwarz <email@hidden>
- Date: Mon, 1 Aug 2005 21:49:16 +0200
Hi everybody,
after reading this ..
http://developer.apple.com/documentation/MacOSX/Conceptual/
universal_binary/universal_binary_tips/chapter_5_section_16.html#//
apple_ref/doc/uid/TP40002217-CH239-291803
.. just to get things right since I'm currently writing a lot of new
Objective-C code. Below simple sample code:
UInt32 maxSizeFromDict (NSDictionary *options)
{
return ([[options objectForKey: @"MaxSize"] intValue]);
}
.. returns 0 for maxSizeFromDict(nil) on PPC. Will it return an
undefinded value on x86 Macs?
.. returns 0 for maxSizeFromDict
(aDictionaryThatDoesNotContainTheMaxSizeKey) on PPC. Will it return
an undefinded value on x86 Macs?
And, asked more generally, should I continue to write "compact" code
as above, or do I have to write less compact code like this in order
to achieve compatiblity with the upcoming x86 Macs:
UInt32 maxSizeFromDict (NSDictionary *options)
{
if (options)
{
NSNumber *myNumber;
if (myNumber = [options objectForKey: @"MaxSize"])
{
return ([myNumber intValue]);
}
}
return (0);
}
Either way, if I know which route to take, it'll probably save me
tons of time when porting what I currently write to the Intel Macs.
Thus, an answer would be highly appreciated. Thanks in advance.
Best regards,
Felix
_______________________________________________
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