[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-dev: gEDA-user: What to do with some bugs?
>>> 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.".
> You're confusing "may" and "must" cases. The value 0 may be a null
> pointer constant [...]
> (6.3.2.3.3 defines two such cases, one of which must be a NPC in the
> context of a pointer conversion, but does not require that both be or
> it would have used "and").
Hmm. I think I see the underlying discrepancy.
You appear to be reading the first sentence as being "a null pointer
constant is some implementation-defined (or undefined) thing, which
might be an integer constant expression with value 0, or might be such
an expression cast to void *, or might be something else entirely".
I'm reading it as "`null pointer constant' means anything that fits
either [description A] or [description B]", as in "a father, or a
mother, is called a parent".
I suppose it would take an interpretation ruling to settle that
definitely, though it seems odd that they'd list two possibilities if
others exist - it is not a tutorial document. For what it may be
worth, K&Rv2 seems to be closer to my interpretation than yours (page
102 says unadorned zero converts to a null pointer, and A6.6, on page
198, rephrases 6.3.2.3.3 in a way substantially closer to my
interpretation).
However, your reading calls into question significant portions of the
rest of the standard; for example, 6.3.2.1.1 says "An lvalue is an
expression with an object type or an incomplete type other than void" -
does this mean that an lvalue is one or the other of those or perhaps
some third thing, and the implementation gets to pick which one?
>> NULL *is* a "null pointer constant" in all contexts.
> But the value 0 is NOT a null pointer constant in all contexts.
I believe it is, in that I see it as fitting the definition: it is "an
integer constant expression with value 0, or [something else]".
> And before we start throwing qualifications around... I'm [...]
Was I throwing qualifications around? I didn't think so.
Anyway, NULL issues aside, there are other problems. I'll send a new
message, under a separate Subject:, about them.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@xxxxxxxxxxxxxxxxxxxxxx
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
_______________________________________________
geda-dev mailing list
geda-dev@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev