Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!mimsy!umd5!brl-adm!adm!bdm-thad@Walker-EMH.arpa
From: bdm-thad@Walker-EMH.arpa
Newsgroups: comp.lang.c
Subject: NULL, zero, and readable code
Message-ID: <8170@brl-adm.ARPA>
Date: Mon, 6-Jul-87 02:29:01 EDT
Article-I.D.: brl-adm.8170
Posted: Mon Jul  6 02:29:01 1987
Date-Received: Mon, 6-Jul-87 07:07:44 EDT
Sender: news@brl-adm.ARPA
Lines: 25


Re: NULL vs. zero and readable code
 
I think the problem here is the definition of NULL.  NULL is not, repeat,
NOT, equal to zero, at least the base ten zero.  If I recall my high
school math, zero is a number, the crossover between positive and nega-
tive.  NULL, on the other hand, is the absence of any number.
 
ASCII in fact defines them differently:  NULL is hex 0 while zero is hex
30. Therefore, stdio.h should define NULL as 0x0, not 0 which would be
0x30.  I don't know how most compilers define it.  Aztec C, v3.20 for the
IBM, defines it as (void *)0 so I am afraid others may be wrong as well.
What do your compilers say, gang?
 
As for TRUE and FALSE, FALSE should be 0 or 0x30 and TRUE should be !FALSE.
 
Of course, this may be an exercise in academics:  We tend to do things the 
way they have always been done or the easiest way, not necessarily the 
right way.
 
--
Thad Humphries
The BDM Corporation, Seoul, Korea
DISCLAIMER:  I'm just a Poli Sci major.