Re: !foo vs foo == nil
Re: !foo vs foo == nil
- Subject: Re: !foo vs foo == nil
- From: "Clark Cox" <email@hidden>
- Date: Thu, 21 Aug 2008 13:33:55 -0700
On Thu, Aug 21, 2008 at 1:23 PM, Scott Ribe <email@hidden> wrote:
> You're forgetting that null pointers *must* convert to 0,
Please show me where that is guaranteed.
> this is why if(!foo) works.
if(!foo) works because of:
From 6.5.3.3:
"The expression !E is equivalent to (0==E)."
if(foo) works because of:
From 6.8.4.1:
"In both forms, the first substatement is executed if the expression
compares unequal to 0."
Neither of these involves converting the pointer to an integer.
>I think that would be the "Except as previously
> specified.." part of what you quoted ;-)
--
Clark S. Cox III
email@hidden
_______________________________________________
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