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

Karl Heuer karl at haddock.ima.isc.com
Thu Apr 12 02:42:24 AEST 1990


In article <717 at ssp11.idca.tds.philips.nl> dolf at idca.tds.PHILIPS.nl (Dolf Grunbauer) writes:
>How about [skipping the test for NULL and writing just]
>	free(buffer)
>The manual pages I know allow a NULL pointer and doing nothing in this case.
>Is this generally true ?

It's a new feature of the ANSI C library.  It should be avoided if you need
to retain portability to old implementations.

Karl W. Z. Heuer (karl at ima.ima.isc.com or harvard!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list