Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue
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