• 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: Thomas Engelmeier <email@hidden>
  • Date: Thu, 21 Aug 2008 13:48:43 +0200


Am 21.08.2008 um 13:25 schrieb Chris Holloway:

If you look at section 7.17 of ISO/IEC 9899:1999, then it states that
NULL is a macro which "expands to an implementation-defined null
pointer constant". So, what is a null pointer constant? Section
6.3.2.3 states that "An integer constant expression with the value 0,
or such an expression cast to type void *, is called a null pointer
constant". So, in order for NULL to satisfy the requirement of being a
null pointer constant, it must be either 0 or (void *)0 (as Michael
stated), and hence (int)NULL is guaranteed to be 0.

What I meant was, as you noted correctly, that the memory pattern of an NULL pointer is not necessary sizeof( void * ) bytes containing 0x00. Obviously I overlooked that the standard guarantees the conversion NULL => int results in 0 and vice versa.


Regards,
	Tom_E

_______________________________________________

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


References: 
 >!foo vs foo == nil (From: Torsten Curdt <email@hidden>)
 >Re: !foo vs foo == nil (From: Filip van der Meeren <email@hidden>)
 >Re: !foo vs foo == nil (From: Torsten Curdt <email@hidden>)
 >Re: !foo vs foo == nil (From: "John C. Randolph" <email@hidden>)
 >Re: !foo vs foo == nil (From: "Michael Ash" <email@hidden>)
 >Re: !foo vs foo == nil (From: Thomas Engelmeier <email@hidden>)

  • Prev by Date: Re: !foo vs foo == nil
  • Next by Date: Re: !foo vs foo == nil
  • Previous by thread: Re: !foo vs foo == nil
  • Next by thread: Re: !foo vs foo == nil
  • Index(es):
    • Date
    • Thread