Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.lang.c
Subject: Re: NULL, zero, and readable code
Message-ID: <7335@mimsy.UUCP>
Date: Mon, 6-Jul-87 04:31:04 EDT
Article-I.D.: mimsy.7335
Posted: Mon Jul  6 04:31:04 1987
Date-Received: Tue, 7-Jul-87 00:47:06 EDT
References: <8170@brl-adm.ARPA>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 39

In article <8170@brl-adm.ARPA> bdm-thad@Walker-EMH.arpa writes:
>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.

You are mixing definitions wildly.  C's NULL is an integer constant
zero.  A null set is one that contains no elements.  The integer or
real number zero is the crossover between positive and negative.
But C only cares about C's NULL.

>ASCII in fact defines them differently:  NULL is hex 0 while zero
>is hex 30.

Now you have brought in another irrelevancy.  There are C compilers
that do not use ASCII.  Besides, code 0/0 in ASCII is NUL, not
NULL.

>Therefore, stdio.h should define NULL as 0x0, not 0 which would be
>0x30.

This is all a joke perhaps?  C source can be entirely independent
of the base character set [*].  Any ASCII-specific code is your
own doing.  [*Excluding problems with character sets lacking, e.g.,
left brace or vertical bar.  Nonetheless, there are EBCDIC based
C compilers out there.]

Note that `0x0' is indeed an integer constant zero; it should work
as a definition for NULL.  But 0 is not equal to 0x30, although
'0' may be equal to 0x30 on your machine.

>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.

This has been officially mandated as legal in the proposed standard.
I do not like it, but so it goes.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	seismo!mimsy!chris