What C compilers have non-zero null pointers?

Karl Heuer karl at haddock.ima.isc.com
Thu Jul 19 06:25:56 AEST 1990


In article <12288 at netcom.UUCP> ergo at netcom.UUCP (Isaac Rabinovitch) writes:
>	for (ptr = fist; ptr != 0; ptr = ptr->next)
>	for (ptr = first; ptr ; ptr = ptr->next)
>which produces tighter code and (most important of all) looks
>spiffier.

There is no reason it should produce tighter code; the compiler still has
to generate a compare against zero.  And whether it "looks spiffier" is a
matter of taste.  I personally switched to explicit compares (against an
*appropriately typed* zero!) many years ago.  Redundancy is your friend.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint
if (i != 0 && c != '\0' && x != 0.0 && p != NULL) abort();



More information about the Comp.lang.c mailing list