• 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: Bindings, NSNumber equal to NIL and performing mathematical operations issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue


  • Subject: Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue
  • From: Clark Cox <email@hidden>
  • Date: Fri, 6 May 2005 09:34:14 -0400

On 5/5/05, Eric Hochmeister <email@hidden> wrote:
> Hi Ricky,
>
> > Note that you should be careful when sending messages to null such
> > that the return type isn't an object, but some primitive type.
> >
> > Thus, you should rewrite result to do the guard against num1 and/or
> > num2 being nil.
>
> Thanks for the reply, I thought of doing the guard against num1 and/or
> num2 being nil, but I'm finding it hard to believe that this issue has
> not already been addressed somehow differently.  It just seems like
> alot of work to have to check if an NSNumber is nil *every* time I
> want to do a calculation with it.
>
> Is there really no other way?

There really isn't. Unless you're expecting an object pointer, or
you're ignoring the return value, do not send messages to nil.

http://www.livejournal.com/community/macosxdev/86254.html

--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/
 _______________________________________________
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: Bindings, NSNumber equal to NIL and performing mathematical operations issue
      • From: Ondra Cada <email@hidden>
    • Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue
      • From: Andy Lee <email@hidden>
References: 
 >Bindings, NSNumber equal to NIL and performing mathematical operations issue (From: Eric Hochmeister <email@hidden>)
 >Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue (From: Ricky Sharp <email@hidden>)
 >Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue (From: Eric Hochmeister <email@hidden>)

  • Prev by Date: table column with <date value> null placeholder
  • Next by Date: Re: Setting the contents of an NSTokenField programatically
  • Previous by thread: Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue
  • Next by thread: Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue
  • Index(es):
    • Date
    • Thread