Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: What C compilers have non-zero null pointers? Message-ID: <17116@haddock.ima.isc.com> Date: 18 Jul 90 20:25:56 GMT References: <9007161750.AA00664@edison.CHO.GE.COM> <12288@netcom.UUCP> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 13 In article <12288@netcom.UUCP> ergo@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@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint if (i != 0 && c != '\0' && x != 0.0 && p != NULL) abort();