Re: [Obj-C] if (self) vs. if (self != nil)
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