Is "if (!pointer)" as portable as "if (pointer == NULL)" ???

Dolf Grunbauer dolf at
Wed Apr 11 19:41:19 AEST 1990

In article <1461 at> diamond at (diamond at tkovoa) writes:
<In article <656 at hades.OZ> greyham at hades.OZ (Greyham Stoney) writes:
<>	if (buffer) free(buffer)
<This is also portable, and almost readable.  Again, to be really readable,
<you should still compare to NULL, but I grant that it would make your
<source code longer this time.

How about just a:

The manual pages I know allow a NULL pointer and doing nothing in this case.
Is this generally true ?
Dolf Grunbauer          Tel: +31 55 433233  Internet dolf at
Philips Telecommunication and Data Systems  UUCP ....!mcsun!philapd!dolf
Dept. SSP, P.O. Box 245, 7300 AE Apeldoorn, The Netherlands         n   n   n
It's a pity my .signature is too small to show you my solution of  a + b = c

More information about the Comp.lang.c mailing list