"do ... while ((NULL + 1) - 1);" -- valid C?

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Aug 16 14:27:07 AEST 1989


In article <828 at ruso.UUCP> wolfgang at ruso.UUCP (Wolfgang Deifel) writes:
>it will return (char*)0 ( regardless of the machine or the compiler ),
>and here it's legal to add '1' ( the result is (char*)1 ).

What is this, a time-shift phenomenon?  We keep getting a sprinkling
of articles making this incorrect claim.  It is NOT legal to perform
arithmetic on a null pointer.



More information about the Comp.lang.c mailing list