Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Garbage Collection woes...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage Collection woes...




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>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.