Seven Original Sins of K&R (Long)
Rick Schubert
rns at se-sd.SanDiego.NCR.COM
Wed Oct 3 00:26:28 AEST 1990
[I know I should probably let this go since this is a dead issue, but I
couldn't resist improving on Henry's answer. I hope I'm not missing
something, since I'm surprised he didn't also say what I'm going to.]
In <1990Sep28.144753.23727 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
>In article <1990Sep27.131329.26616 at phri.nyu.edu> roy at phri.nyu.edu (Roy Smith) writes:
>>... I meant to
>>write:
>>
>>#define NULL (""[0])
>Roy, apart from not being a compile-time value, which limits its use,
>this is exactly and precisely equivalent to
>#define NULL 0
Since (""[0]) is not a compile-time value (I assume that's the same thing
as a constant expression), it is also not a null-pointer constant.
It DOES have the value 0, but the only arithmetic expressions that
are null pointers are those that are constant expressions evaluating to 0.
-- Rick Schubert (rns at se-sd.sandiego.NCR.COM)
More information about the Comp.lang.c
mailing list