Or we might want to invent a new zero type to distinguish between an uninitialized variable and one with the value of a failed indexing operation.
/ Martin Nilsson (Åskblod)
Previous text:
2003-01-22 07:09: Subject: Re: zero_type() & UNDEFINED (bug?)
The whole purpose of UNDEFINED is the ability to get to the special case of zero that UNDEFINED is without using a kludge such as ([])[0]. In general you would on the other hand test for such a value using zero_type().
However you can't use if(variable == UNDEFINED) { ... } since that will match if variable is either 0 or UNDEFINED.
On a related note, I think it would be nice if uninitialized variables ended up being UNDEFINED rather than 0. I.e:
int i; [... do something ...] if(zero_type(i)) { blah }
/ David Hedbor