Re: Checking for NULL (was "Re: Can't get setDelegate to work...")
Re: Checking for NULL (was "Re: Can't get setDelegate to work...")
- Subject: Re: Checking for NULL (was "Re: Can't get setDelegate to work...")
- From: Stuart Malin <email@hidden>
- Date: Wed, 4 Mar 2009 12:40:34 -1000
On Mar 4, 2009, at 12:15 PM, email@hidden wrote:
In any case, and perhaps based purely on habit, I find it difficult to
even write:
NSStatusItem statusItem = [[[NSStatusBar systemStatusBar]
statusItemWithLength:NSVariableStatusItemLength] retain];
...in favor of:
NSStatusBar *systemBar = [NSStatusBar systemStatusBar];
if (systemBar != NULL)
{
AFAIU(nderstand):
While nil and NULL may operate interchangeably (in most cases?),
semantically, they are not the same thing.
In your code fragment above, I believe most Cocoa programmers would
expect to see:
if (systemBar != nil) ....
NULL is used more to indicate a null value c pointer.
At one time I was under the impression they were defined differently:
nil being of type id, and NULL being a void*
But in trying to research this, I run across much conflicting info and
suspect perhaps this has either changed over time, and/or depends on
whether the use is in/with C++ or not. Perhaps some of the experts on
this list can provide some clarity....
_______________________________________________
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