argv[] terminated by a NULL pointer?
David Brooks
dbrooks at osf.org
Sat Jun 29 00:29:52 AEST 1991
djimenez at ringer.cs.utsa.edu (Daniel Jimenez) writes:
|> Who said the null pointer couldn't be -1?
Who's allowed to know?
|> On a system where the null pointer is represented by all bits one,
|> the following statement:
|> ((char *)0) == ((char *)-1)
|> would be true, since 0 in a pointer context is defined to be
|> the null pointer, and -1 is also the null pointer.
|> They would have the same bit pattern.
Is this strictly true? I know that the conversion of an *object* of
integral type is allowed to go through an implementation-dependent mapping,
although K&RII (at least) doesn't seem to mention an integer constant.
It would be rather perverse to map (char *)-1 to 0x8129ac60, but I could
imagine a compiler writer wanting to avoid mapping -1 to a value internally
identical to a null pointer.
--
David Brooks dbrooks at osf.org
Systems Engineering, OSF uunet!osf.org!dbrooks
Composing for a percussion ensemble is like writing an essay in highlighter.
More information about the Comp.lang.c
mailing list