Re: Properly writing an Init method
Re: Properly writing an Init method
- Subject: Re: Properly writing an Init method
- From: James DiPalma <email@hidden>
- Date: Wed, 17 Jul 2002 16:11:55 -0400
If you are going to worry about nil someday not equalling zero, I would
recommend not depending on nil equalling zero in your init method. I
write init methods more like this:
- (id) init
{
self = [super init];
if (nil != self) {
// stuff
}
return self;
}
I never did like having an assignment inside an if statement.
On Wednesday, July 17, 2002, at 01:39 PM, Don Yacktman wrote:
While nil and NULL are both defined to be zero in the current
implementation, "nil" is the proper return for an Objective-C
non-object, not NULL.
-jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.