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

Dolf Grunbauer dolf at idca.tds.PHILIPS.nl
Wed Apr 11 19:41:19 AEST 1990


In article <1461 at tkou02.enet.dec.com> diamond at tkou02.enet.dec.com (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:
	free(buffer)

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 idca.tds.philips.nl
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