• 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: nil pointers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nil pointers


  • Subject: Re: nil pointers
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 11 Jul 2006 15:52:23 -0700

On Jul 11, 2006, at 3:42 PM, Uli Kusterer wrote:
Bill Bumgarner wrote:
You could likely also go for ((id) -1)-- whatever the magic cast would be-- as that should produce an address that cannot possibly be a pointer to anything as it is the very last byte of address space (no room for the other 3 bytes of the address).

I think you mistyped here. No room for more than the first byte of the object. The address will always have enough memory because you've likely already allocated an ivar or local to hold it.

The first slot of an object is always a pointer to the object's metaclass -- the structure that holds the class information -- and the above was an offhand suggestion that initializing a pointer to the very last address in the address space is going to guarantee that any reference through the isa "pointer" is going to explode most spectacularly.


I don't remember why that was any better than the original suggestion of 0x1. :-)

As per using some nonsense number in the middle of the address space...
... one shouldn't really be mixing and matching between integral and pointer types. It is just begging for trouble. Pointer types always show up as 0x###### and, thus, are readily distinguishable from integral types.


In any case, this conversation has gotten a bit pendantically tangential to Cocoa-Dev. Just toss a consistent non-sense number into your pointers upon initialization.

b.bum

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >nil pointers (From: "Adam Johnson" <email@hidden>)
 >Re: nil pointers (From: Uli Kusterer <email@hidden>)
 >Re: nil pointers (From: Rob Ross <email@hidden>)
 >Re: nil pointers (From: Andreas Mayer <email@hidden>)
 >Re: nil pointers (From: Bill Bumgarner <email@hidden>)
 >Re: nil pointers (From: Uli Kusterer <email@hidden>)
 >Re: nil pointers (From: glenn andreas <email@hidden>)
 >Re: nil pointers (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: non-ASCII characters in CFString literal [Was: (no subject)]
  • Next by Date: Re: non-ASCII characters in CFString literal [Was: (no subject)]
  • Previous by thread: Re: nil pointers
  • Next by thread: Re: nil pointers
  • Index(es):
    • Date
    • Thread