• 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
Re: Universal Binaries and messages to nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Universal Binaries and messages to nil


  • Subject: Re: Universal Binaries and messages to nil
  • From: glenn andreas <email@hidden>
  • Date: Sun, 5 Feb 2006 16:20:35 -0600


Currently, I often lazily rely on a message to (what
should be) an NSNumber returning zero if the NSNumber
is actually nil, especially when dealing with user
defaults, as in the following example:

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

Why not use:

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

(this doesn't solve the general problem of "how to best handle nil receivers and floating point return values" but does take care of the specific example)


Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! quadrium | build, mutate, evolve | images, textures, backgrounds, art

_______________________________________________
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


  • Follow-Ups:
    • Re: Universal Binaries and messages to nil
      • From: Keith Blount <email@hidden>
References: 
 >Universal Binaries and messages to nil (From: Keith Blount <email@hidden>)

  • Prev by Date: Re: Beast approach for doing a syntax coloring editor?
  • Next by Date: Re: NSArrayController Difficulties
  • Previous by thread: Re: Universal Binaries and messages to nil
  • Next by thread: Re: Universal Binaries and messages to nil
  • Index(es):
    • Date
    • Thread