FROM : glenn andreas
DATE : Tue Jul 11 20:07:14 2006
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_removed>
<http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets
DATE : Tue Jul 11 20:07:14 2006
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_removed>
<http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets
| Related mails | Author | Date |
|---|---|---|
| Adam Johnson | Jul 11, 04:59 | |
| John C. Randolph | Jul 11, 05:11 | |
| Agent M | Jul 11, 05:26 | |
| j o a r | Jul 11, 09:19 | |
| Uli Kusterer | Jul 11, 18:20 | |
| Rob Ross | Jul 11, 18:40 | |
| Todd Ransom | Jul 11, 18:52 | |
| Shawn Erickson | Jul 11, 18:57 | |
| Andreas Mayer | Jul 11, 19:00 | |
| Bill Bumgarner | Jul 11, 19:06 | |
| Uli Kusterer | Jul 11, 19:41 | |
| Bill Bumgarner | Jul 11, 19:59 | |
| Nat! | Jul 11, 20:06 | |
| glenn andreas | Jul 11, 20:07 | |
| Uli Kusterer | Jul 12, 00:42 | |
| Bill Bumgarner | Jul 12, 00:52 |






Cocoa mail archive

