Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!amdcad!tim From: tim@amdcad.AMD.COM (Tim Olson) Newsgroups: comp.lang.c Subject: Re: Writing readable code (what is NULL) Message-ID: <17466@amdcad.AMD.COM> Date: Fri, 10-Jul-87 14:59:14 EDT Article-I.D.: amdcad.17466 Posted: Fri Jul 10 14:59:14 1987 Date-Received: Sun, 12-Jul-87 11:58:17 EDT References: <8249@brl-adm.ARPA> Reply-To: tim@amdcad.UUCP (Tim Olson) Organization: Advanced Micro Devices, Inc., Sunnyvale, Ca. Lines: 21 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. AARRRGH!!! *PLEASE* people -- we've been over this time after time: 1) #define NULL 0 2) When using NULL as a parameter, cast it to the *correct* type The above definition of NULL will choke on systems which have different bit patterns for different pointer types. -- Tim Olson Advanced Micro Devices (tim@amdcad.amd.com)