Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!nbires!vianet!devine From: devine@vianet.UUCP (Bob Devine) Newsgroups: comp.lang.c Subject: Re: Writing readable code (what is NULL) Message-ID: <203@vianet.UUCP> Date: Tue, 14-Jul-87 20:32:14 EDT Article-I.D.: vianet.203 Posted: Tue Jul 14 20:32:14 1987 Date-Received: Fri, 17-Jul-87 04:04:09 EDT References: <8249@brl-adm.ARPA> Organization: Western Digital, Boulder Tech Ctr Lines: 16 In article <8249@brl-adm.ARPA>, Leisner.Henr@Xerox.COM (marty) writes: > Also, it is bad practice to define NULL to be something memory model > dependent. A better practice is: > > #define NULL (char *) 0 > > This automatically takes care of the sizeof dependencies. This gets to > be a major issue when routines are being passed and/or return NULL. Don't do this. For x86 C Compiler memory models, (char*) might be 2, or 4 bytes depending on the model. BUT, there is often mixing of models and there are portability concerns beyond the immediate need. Just use 0 for NULL and cast it appropriately. Bob Devine