• 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: Garbage Collection woes...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage Collection woes...


  • Subject: Re: Garbage Collection woes...
  • From: mmalc crawford <email@hidden>
  • Date: Sun, 29 Jun 2008 00:02:50 -0700


On Jun 27, 2008, at 12:31 PM, John Engelhart wrote:

-(BOOL)doSomething:(id)obj error:(NSError **)error
{
if(error != NULL) { *error = NULL; } // Make sure we clear the error object
}


Why are you doing this?

It's sort of ambiguous as to what should be returned by the indirect error pointer on the condition of success. I could think of several neat ideas if the expected behavior were defined up front, even requiring the caller to initialize the pointer to a default NSError singleton and allowing errors to accumulate in a stack like fashion. Alas, the only clearly defined behavior is that one failure, a NSError object is indirectly returned.

That's exactly what's expected.
"In general, a method should signal an error condition by—for example— returning NO or nilrather than by the simple presence of an error object. The method can then optionally return an NSError object by reference, in order to further describe the error."


mmalc

_______________________________________________

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: 
 >Garbage Collection woes... (From: John Engelhart <email@hidden>)

  • Prev by Date: Re: Why aren't my bindings firing?
  • Next by Date: Re: noob question regarding proxy object returned by -selection method of NSArrayController
  • Previous by thread: Re: Garbage Collection woes...
  • Next by thread: Re: Garbage Collection woes...
  • Index(es):
    • Date
    • Thread