• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Universal Binaries and messages to nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Universal Binaries and messages to nil


  • Subject: Universal Binaries and messages to nil
  • From: Conor Dearden <email@hidden>
  • Date: Mon, 06 Feb 2006 09:20:39 +0100

>Note: With the release of Xcode 2.2, Objective-C messages sent to a nil object
behave the same on both PowerPC and Intel-based Macintosh computers.

You no longer have to worry about it.

>On Intel-based Macintosh computers, messages to a nil object always return 0.0
for methods whose return type is float, double, long double, or long long.

So your code:
NSNumber *marginWidthNumber = [[NSUserDefaults
standardUserDefaults] objectForKey:@"SCRMarginWidth"];
float marginWidth = (marginWidthNumber != nil) ?
[marginWidthNumber floatValue] : 0.0;

Is the same as:

float marginWidth = [[[NSUserDefaults
standardUserDefaults] objectForKey:@"SCRMarginWidth"]
floatValue];

You are still going to get 0.0.

Regards,
Conor


 _______________________________________________
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

  • Prev by Date: Re: COREDATA - setSubEntities doesn't work
  • Next by Date: Re: Custom NSView doesn't redraw itself properly after use of NSPopUpButton
  • Previous by thread: Re: Universal Binaries and messages to nil
  • Next by thread: How to create and show an NSButton programmatically?
  • Index(es):
    • Date
    • Thread