Path: utzoo!attcan!uunet!dasys1!jpr From: jpr@dasys1.UUCP (Jean-Pierre Radley) Newsgroups: comp.lang.c Subject: Re: NULL is not '\0' (was: Is malloc() or calloc() "better"?) Message-ID: <8468@dasys1.UUCP> Date: 26 Jan 89 20:39:46 GMT References: <9254@smoke.BRL.MIL> <620@usl.usl.edu> <11049@tiger.oxy.edu> <11375@haddock.ima.isc.com> Reply-To: jpr@dasys1.UUCP (Jean-Pierre Radley) Organization: TANGENT Lines: 23 In article <11375@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes: >Right idea, wrong name. NULL is a null pointer constant. Please do not >confuse it with the null character. If the built-in name '\0' isn't good >enough, then call it NUL (with one L, as in the ASCII tables). >For nearly accidental reasons, it is quite legal% to write '\0' when you mean >a null pointer constant, though only an Obfuscated C contestant would do so. >Using NULL when you mean a null character, however, is not guaranteed to work >(even with the cast), since (in ANSI C) the macro might expand into (void *)0. Well, I just wasted a lot of time with one my programs because of the following: On the Tandy 6000, the stdio.h file says: #define NULL 0 But I just switched to a Tandy 4000, and the SCO 2.2.4 Xenix stdio.h says: #define NULL (char *)0 "... standards, because there are so many ..." -- Jean-Pierre Radley Honi soit jpr@dasys1.UUCP New York, New York qui mal ...!hombre!jpradley!jpr CIS: 76120,1341 y pense ...!hombre!trigere!jpr