• 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: aborting init
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: aborting init


  • Subject: Re: aborting init
  • From: Graham Cox <email@hidden>
  • Date: Tue, 30 Nov 2010 14:27:27 +1100

On 30/11/2010, at 1:59 PM, Rainer Standke wrote:

> The intended behavior is not to get anything if the conditions are not met.
>
>
> Is this kosher? Do I have to do any kind of clean-up after doing something like that?


Yes, it's OK to do this. As it's your own class, you can do what you like - typically you'd just document its behaviour (returns nil if x,y, and z are not met) if anyone else is likely to use it.

The only thing to be concerned with is correct memory management, which just follows the usual rules.

Returning nil, even unexpectedly, is usually 'safe' in that messages to nil are legal, and are either no-ops or return 0, so unlike C++, if you inadvertently send a message to nil, it doesn't crash.

--Graham_______________________________________________

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

  • Follow-Ups:
    • Re: aborting init
      • From: Michael Watson <email@hidden>
References: 
 >aborting init (From: Rainer Standke <email@hidden>)

  • Prev by Date: Re: How to approach to write such an app?
  • Next by Date: Re: aborting init
  • Previous by thread: aborting init
  • Next by thread: Re: aborting init
  • Index(es):
    • Date
    • Thread