• 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: !foo vs foo == nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: !foo vs foo == nil
      • From: Scott Ribe <email@hidden>
References: 
 >Re: !foo vs foo == nil (From: "Clark Cox" <email@hidden>)
 >Re: !foo vs foo == nil (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: Scaling an NSImage makes the edges disappear.
  • Next by Date: Re: Scaling an NSImage makes the edges disappear.
  • Previous by thread: Re: !foo vs foo == nil
  • Next by thread: Re: !foo vs foo == nil
  • Index(es):
    • Date
    • Thread