sizeof ((rehash *) 0)->again

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Nov 22 09:50:28 AEST 1989


In article <11146 at riks.csl.sony.co.jp> diamond at ws.sony.junet (Norman Diamond) writes:
>In the part of my posting which you deleted, I pointed out where the
>standard deliberately does not define a cast null pointer to be a
>null pointer constant, unless the cast is to void *.

Which has nothing to do with it.  "Null pointer constant" has technical
uses within the standard, but both null pointer constants AND other
kinds of null pointers don't point to anything.

>Therefore the compiler cannot take advantage at compile time of knowing
>that this is a null pointer; ...

Your argument supports the position that conforming implementations are
not REQUIRED to diagnose ((foo*)0)->bar, but compilers that are able to
recognize that situation, so far as I can determine, MAY diagnose it at
compile time as a semantic violation, in which case it would be folly to
use such a construct in code intended to be portable.

As I've said before, I think this deserves an official "interpretation"
ruling.



More information about the Comp.std.c mailing list