Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!seismo!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: net.unix-wizards Subject: Re: Microport Unix -- Large Model Problems Message-ID: <5174@brl-smoke.ARPA> Date: Tue, 4-Nov-86 12:24:58 EST Article-I.D.: brl-smok.5174 Posted: Tue Nov 4 12:24:58 1986 Date-Received: Wed, 5-Nov-86 06:29:06 EST References: <188@vsedev.VSE.COM> <401@maynard.UUCP> <245@rabbit1.UUCP> <347@prairie.UUCP> <405@maynard.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Distribution: net Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 22 In article <405@maynard.UUCP> campbell@maynard.UUCP (Larry Campbell) writes: >I wonder why stdio.h doesn't just declare NULL as "(char *) 0", or, >in the brave new world of ANSI X-whatever, "(void *) 0"? This should >do all the right things. How quickly people forget. In pre-X3J11 C, no single data type is correct for null pointers in all contexts, particularly in actual parameters to functions. These should ALWAYS be written as NULL (or 0) cast to pointers of the correct type. The best definition of NULL in for these implementations is the integer constant 0. Some of us would even argue that that is the only completely correct choice. In X3J11 C, if a function prototype is in scope, casting of function parameters is automatically done, and either (void *)0 or 0 is a correct definition for NULL. I recommend that you assume that NULL is defined to be the int constant 0 (even if it isn't on your current system), and always cast it to the correct pointer type when used as an actual parameter. This practice will continue to work under X3J11.