Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!nike!oliveb!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix-wizards Subject: Re: Microport Unix -- Large Model Problems Message-ID: <8946@sun.uucp> Date: Wed, 5-Nov-86 14:41:45 EST Article-I.D.: sun.8946 Posted: Wed Nov 5 14:41:45 1986 Date-Received: Wed, 5-Nov-86 22:44:26 EST References: <188@vsedev.VSE.COM> <401@maynard.UUCP> <245@rabbit1.UUCP> <347@prairie.UUCP> <405@maynard.UUCP> Distribution: net Organization: Sun Microsystems, Inc. Lines: 18 > 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. No, it shouldn't. Passing a "(char *)0" to a routine that expects an "int *" of some sort is NOT guaranteed to work. If, in fact, you have a machine on which "char *" is longer than "int *", it is very unlikely to work. In the brave new world of ANSI X3J11, the right thing to do is to use function prototypes; if you do this, almost all the 0's will be automatically converted into null pointers of the appropriate type by the compiler. (It still won't work for "execl"; if you hack NULL to be "(char *)0", it fixes *this* case, but it may not work for some routine that expects an "(int *)0" at the end of its argument list.) -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)