• 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: changing NSNumber from within another function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing NSNumber from within another function


  • Subject: Re: changing NSNumber from within another function
  • From: Alastair Houghton <email@hidden>
  • Date: Fri, 28 Mar 2008 18:19:36 +0000

On 28 Mar 2008, at 17:29, Nick Zitzmann wrote:

On Mar 28, 2008, at 10:00 AM, Alastair Houghton wrote:

To answer your actual question, you might write:

- (void)function2:(NSNumber **)value
{
  *value = [NSNumber numberWithBool:YES];
}

Careful about that - if value is NULL, then that will cause a crash. That's why you have to check to make sure value is not NULL first.

A crash might be better than failing silently in some cases. It's a judgement call, obviously, and certainly something to think about.


Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >changing NSNumber from within another function (From: Nick Rogers <email@hidden>)
 >Re: changing NSNumber from within another function (From: Alastair Houghton <email@hidden>)
 >Re: changing NSNumber from within another function (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: How to ^set^ preferred localizations?
  • Next by Date: Re: Communications between multiple NIB's
  • Previous by thread: Re: changing NSNumber from within another function
  • Next by thread: CATextLayer and subpixel anti-aliasing
  • Index(es):
    • Date
    • Thread