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

Karl Heuer karl at
Thu Apr 12 02:42:24 AEST 1990

In article <717 at> dolf at (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 or harvard!ima!karl), The Walking Lint

More information about the Comp.lang.c mailing list