Header problems
Richard Harter
g-rh at cca.CCA.COM
Wed Mar 9 09:40:10 AEST 1988
In article <3351 at chinet.UUCP> dag at chinet.UUCP (Daniel A. Glasser) writes:
>In article <7412 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>
>Your use of NULL === 0 promotes unportable code, and is considered to be
>bad programming style in a world where portability across multiple machine
>architectures (ie, PDP-11, VAX-11, M680x0, I80x86 and Z800x) is required
>for commercial reasons.
>
This comes up regularly. There is nothing wrong defining NULL as
0; it does not make for non-portability. The fault lies in passing NULL
as an uncasted pointer across a calling sequence. Since lint will tell
you about this, there is no good reason for this happening. In actual
fact, I am wary of using (void *)0 for portability reasons -- I don't
know (and don't care) if all implementations that I have to deal with
handle it correctly. I do know that all implementations handle
(proper_type *)0 correctly. [Actually I don't know that, but I've never
seen it fail.]
--
In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die.
Richard Harter, SMDS Inc.
More information about the Comp.lang.c
mailing list