• 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: glenn andreas <email@hidden>
  • Date: Tue, 11 Jul 2006 13:07:14 -0500


On Jul 11, 2006, at 12:41 PM, Uli Kusterer wrote:

Am 11.07.2006 um 19:06 schrieb Bill Bumgarner:
NSArray *arrayIAmGoingToGetFromSomewhereMaybe = (id) 0x1;

Whoa! I think I'm going to request that that be made an official constant:


#define INVALID ((id) 0x01)

that guarantees an access exception. For platforms that have no address that's guaranteed to be invalid, they could always create a singleton that just dies on receiving any message.

How about something more "deadbeef"ish like:

#define COCOA_INVALID ((id) 0xC0C0ABAD)

That way your not likely to get confused with a stray 1 or -1 (for example, register coloring may result in sharing a local variable with an integer that could easily be 1 or -1, and C0C0ABAD would be clearly an "invalid initialized" id instead of an "accidentally uninitialized variable")


Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! Widgetarium | the quickest path to widgets

_______________________________________________
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


  • Follow-Ups:
    • Re: nil pointers
      • From: Uli Kusterer <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>)

  • Prev by Date: Re: NSBox frame redraw issue
  • Next by Date: Re: How to properly add a document with -addDocument
  • Previous by thread: Re: nil pointers
  • Next by thread: Re: nil pointers
  • Index(es):
    • Date
    • Thread