gEDA-dev: gEDA-user: What to do with some bugs?
der Mouse
mouse at Rodents.Montreal.QC.CA
Sun Apr 27 22:47:14 EDT 2008
> The ISO/IEC 9899:1999 C standard defines NULL as "an
> implementation-defined null pointer constant" - no more, no less.
Right. Now go look at 6.3.2.3: "An integer constant expression with
the value 0, or such an expression cast to type void *, is called a
null pointer constant.".
I see no leeway there.
> It does say that the integer value 0 may be treated as a null
> pointer, but does not say that it can be a suitable expansion of the
> NULL macro.
I think it does. 7.17 says NULL is defined to a null pointer constant,
and 6.3.2.3 defines what a "null pointer constant" is, one of the
options for which is unadorned 0.
> It doesn't say it cannot - the implementation may choose to do so if
> that results in NULL being a null pointer constant in all contexts.
NULL *is* a "null pointer constant" in all contexts. But a "null
pointer constant" does not necessarily have any particular type. In a
context which provides a pointer type, a null pointer constant is
converted to a null pointer of the appropriate type. In a context
which does not provide a type, you can get either integer zero or a
void * null pointer - which are not necessarily the same in size, bit
pattern, alignment, nor even parameter passing mechanism.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
More information about the geda-dev
mailing list