> > 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"). The macro NULL must expand to a null pointer constant in all contexts. The implementation must meet these constraints; in the case where 0 is not suitable, it is not an option. For 64 bit hosts, the second 6.3.2.3.3 option is chosen - the value 0 cast to a void* type. > NULL *is* a "null pointer constant" in all contexts. But the value 0 is NOT a null pointer constant in all contexts. 6.3 talks about conversions to types; 6.3.2.3 talks about conversions to pointers. If you're in a context where a conversion to pointer is not called for (such as ...), you cannot assume that 6.3.2.3.3 applies. However, that doesn't stop implementations from being stupid. Or smart. Like I said, find an actual implementation where NULL doesn't work for ..., that isn't some obscure system that PCB won't work on anyway, and we'll talk about it. We must be practical. And before we start throwing qualifications around... I'm one of GCC's maintainers and I work on GCC at my job at Red Hat. That doesn't mean I'm just going to ignore your complaints, it just means I'm only going to be impressed by actual data and real-life cases, not over-detailed reading of a spec that implementations don't always have to follow. _______________________________________________ geda-dev mailing list [email protected] http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
