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: Kyle Sluder <email@hidden>
- Date: Sat, 25 Feb 2012 07:38:23 -0800
On Feb 25, 2012, at 7:26 AM, Scott Ribe <email@hidden> wrote:
> On Feb 25, 2012, at 8:23 AM, Kyle Sluder wrote:
>
>> And then show how that jives with footnote 56, which says that the intent of the standard is that null pointers become whatever integer is most similar to the bit pattern used for null pointers, which may or may not be the same as that used for integer zero depending on the platform.
>
> Hmm. So Harbison & Steele (5th Edition) is wrong??? That's a surprise to me.
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)?
The first is an error. That is plain black and white in the standard. The second is quite possible, even likely. But because the standard just says "compared to 0" rather than "compared to an nether constant expression with the value 0," I don't know if it's guaranteed by the standard.
--Kyle Sluder
_______________________________________________
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