On Thu, Aug 21, 2008 at 12:38 PM, Scott Ribe <[EMAIL PROTECTED]> wrote: >> as long as, when >> __builtin_special_null_keyword_that_is_specific_to_my_compiler is >> converted to a pointer type, it becomes a null pointer. > > And, if converted to integer type, it becomes 0.
No, converting a pointer type (any pointer type, null or otherwise) results in implementation defined behavior or undefined behavior. From 6.3.2.3 6: "Any pointer type may be converted to an integer type. Except as previously specified, the result is implementation-defined. If the result cannot be represented in the integer type, the behavior is undefined. The result need not be in the range of values of any integer type." That is, this always yields a null pointer to foo: foo *ptr = 0; This, on the other hand, is not guaranteed to yield zero (despite the fact that it does yield zero on most platforms) int i = (int)ptr; There is nothing preventing a compiler from compiling: int i = (int)NULL; to: int i = 42; > Right; I was certainly > talking about standard integer/pointer types, without compiler magic, which > must be 0, not any other value. Thing is, even the special compiler keyword > is *indistinguishable* from 0, except for type checking rules. It is distinguishable from 0, in that it is not guaranteed that you can convert it to an int. -- Clark S. Cox III [EMAIL PROTECTED]
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]