• 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: Properly writing an Init method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Properly writing an Init method (From: Don Yacktman <email@hidden>)

  • Prev by Date: Re: [Seriously OT]Mac.com 60 days and counting
  • Next by Date: Re: Properly writing an Init method
  • Previous by thread: Re: Properly writing an Init method
  • Next by thread: Re: Properly writing an Init method
  • Index(es):
    • Date
    • Thread