Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Class clusters and the superclass' initializer implementation



Hey,

Theoretical question which is probably much ado about nothing: in the abstract superclass of a class cluster, what should the actual implementation of the primitive initializer(s) look like? (I need one, or else gcc will complain.) Currently I have:

- (id)initWithData:(NSData *)data withOptions:(NSDictionary *)options error:(NSError **)errorPtr
{
[self doesNotRecognizeSelector:_cmd];
return nil;
}


but in a theoretical case where this actually would get called, we'd get an orphaned object floating around, because there's no call to [self release] in there. Placing a [self release] before or after the -doesNotRecognizeSelector: call wouldn't work: before would mean sending a message to a freed object and after would never get called, since -doesNotRecognizeSelector: raises an exception. I'm leaning towards a simple [self autorelease] as the first line... is there another standard for what these kinds of methods should look like?

-John Calsbeek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.