Re: Memory allocation issues with NSObject and NSString
Re: Memory allocation issues with NSObject and NSString
- Subject: Re: Memory allocation issues with NSObject and NSString
- From: Michael Ash <email@hidden>
- Date: Mon, 19 Jan 2009 00:05:00 -0500
On Sun, Jan 18, 2009 at 11:21 PM, Bill Bumgarner <email@hidden> wrote:
>> 2. If I have an NSObject class and I define an init messge, do I have
>> to do self = [super init] or is that not important when extending from
>> NSObject.
>
> Yes, it is important.
>
> But it does next to nothing.
>
> For now. Someday, that might change.
I sure hope not! The documentation for the method states:
"The init method defined in the NSObject class does no initialization;
it simply returns self."
Making it do anything else would be a serious breach of the API contract.
However I strongly advocate calling it anyway, as it makes your code
more robust if you change the superclass later on to something that
really does do something in init.
Mike
_______________________________________________
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