• 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: [Obj-C] if (self) vs. if (self != nil)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Obj-C] if (self) vs. if (self != nil)


  • Subject: Re: [Obj-C] if (self) vs. if (self != nil)
  • From: Scott Ribe <email@hidden>
  • Date: Sat, 25 Feb 2012 08:45:48 -0700

On Feb 25, 2012, at 8:38 AM, Kyle Sluder wrote:

> Does Harbison & Steele say that pointers converted to integer have the value zero, or does it say that if(ptr) is identical to if(ptr != 0)?

It explicitly states that null pointers converted to int are 0, and that other conversions are implementation-defined but round-trip conversions through a large-enough int type produce the original pointer.

I have a suspicion that this is a normalization in behavior introduced in the standardization process--note that I still have K&R 2nd edition here, and as far as I can tell it simply does not specify what happens when a null pointer is converted to int.

--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice





_______________________________________________

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: [Obj-C] if (self) vs. if (self != nil)
      • From: Kyle Sluder <email@hidden>
References: 
 >[Obj-C] if (self) vs. if (self != nil) (From: Oleg Krupnov <email@hidden>)
 >Re: [Obj-C] if (self) vs. if (self != nil) (From: Wade Tregaskis <email@hidden>)
 >Re: [Obj-C] if (self) vs. if (self != nil) (From: Scott Ribe <email@hidden>)
 >Re: [Obj-C] if (self) vs. if (self != nil) (From: Kyle Sluder <email@hidden>)
 >Re: [Obj-C] if (self) vs. if (self != nil) (From: Scott Ribe <email@hidden>)
 >Re: [Obj-C] if (self) vs. if (self != nil) (From: Kyle Sluder <email@hidden>)
 >Re: [Obj-C] if (self) vs. if (self != nil) (From: Scott Ribe <email@hidden>)
 >Re: [Obj-C] if (self) vs. if (self != nil) (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: [Obj-C] if (self) vs. if (self != nil)
  • Next by Date: Re: [Obj-C] if (self) vs. if (self != nil)
  • Previous by thread: Re: [Obj-C] if (self) vs. if (self != nil)
  • Next by thread: Re: [Obj-C] if (self) vs. if (self != nil)
  • Index(es):
    • Date
    • Thread