[comp.lang.c] Zero/nil/NULL/NUL/0/...

gnat@kauri.vuw.ac.nz (Nathan Torkington) (04/20/91)

I have read the FAQ and this doesn't seem to be what I'm after.  What I
am looking for is an explicit list of things which 0 (zero decimal, zero
octal, zero hexadecimal, etc) stand for.  So far I have :
  -> The number zero (in any base)
  -> The unused pointer (in some machines)
  -> The null character (ASCII, etc)
  -> End of file (EOF)
  -> Not true (FALSE)

Nat.
--
Nathan Torkington                           Contracting to CSC,
Internet: gnat@kauri.vuw.ac.nz              Victoria University Of Wellington,
WetComms: +64 4 853 881 (post-chronos)      P.O. Box 600, New Zealand.
This is not an official communication of any part of Victoria University.

RAMSGATE (n.)  All institutional buildings must, by law, contain at least
twenty ramsgates.  These are doors which open the opposite way to the one you
expect.
                 - "The Meaning Of Liff" by Douglas Adams and John Lloyd

ckp@grebyn.com (Checkpoint Technologies) (04/20/91)

In article <GNAT.91Apr20183721@kauri.kauri.vuw.ac.nz> gnat@kauri.vuw.ac.nz (Nathan Torkington) writes:
>I have read the FAQ and this doesn't seem to be what I'm after.  What I
>am looking for is an explicit list of things which 0 (zero decimal, zero
>octal, zero hexadecimal, etc) stand for.  So far I have :
>  -> The number zero (in any base)
>  -> The unused pointer (in some machines)
       Er, really a pointer which is not pointing to anything.  This
       should be true of all machines. (Go read the FAQ again.)
>  -> The null character (ASCII, etc)
>  -> End of file (EOF)
       Actually this is untrue.  0 can be a valid file character, so EOF
       must not be 0; typically EOF is -1.
>  -> Not true (FALSE)

Offhand, I can't think of any other "meanings" C gives to 0.
-- 
First comes the logo: C H E C K P O I N T  T E C H N O L O G I E S      / /  
                                                ckp@grebyn.com      \\ / /    
Then, the disclaimer:  All expressed opinions are, indeed, opinions. \  / o
Now for the witty part:    I'm pink, therefore, I'm spam!             \/

stanley@phoenix.com (John Stanley) (04/21/91)

gnat@kauri.vuw.ac.nz (Nathan Torkington) writes:

> I have read the FAQ and this doesn't seem to be what I'm after.  What I
> am looking for is an explicit list of things which 0 (zero decimal, zero
> octal, zero hexadecimal, etc) stand for.  So far I have :
>   -> The number zero (in any base)

   Yes, zero is zero.

>   -> The unused pointer (in some machines)

   Do you mean "the null pointer"? It is possible to have used a pointer
and for it to be null. For example, you may use it to indicate to a
function that it should ignore a pointer parameter. Or, fopen returns
a NULL pointer on failure. In either case, the pointer has been used.

   In any case, the null pointer is NULL, which may or may not be hex
0.

>   -> End of file (EOF)

   EOF is not 0, since there would be no way to differentiate it from
the NUL character.

c60b-1eq@e260-1g.berkeley.edu (Noam Mendelson) (04/21/91)

In article <GNAT.91Apr20183721@kauri.kauri.vuw.ac.nz> gnat@kauri.vuw.ac.nz (Nathan Torkington) writes:
>I have read the FAQ and this doesn't seem to be what I'm after.  What I
>am looking for is an explicit list of things which 0 (zero decimal, zero
>octal, zero hexadecimal, etc) stand for.  So far I have :
>  -> The number zero (in any base)
>  -> The unused pointer (in some machines)
      ^^^^^^^^^^^^^^^^^^
Unused pointers are not automatically initialized to NULL.

>  -> The null character (ASCII, etc)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
On most but not all machines.

>  -> End of file (EOF)
      ^^^^^^^^^^^^^^^^^
No, EOF is implementation-dependent but is usually == -1.

>  -> Not true (FALSE)

If you look through your's machines header files, you'll find quite a lot
of things which are #def'ed to zero.  So what?

-- 
+==========================================================================+
| Noam Mendelson   ..!ucbvax!web!c60b-1eq       | "I haven't lost my mind, |
| c60b-1eq@web.Berkeley.EDU                     |  it's backed up on tape  |
| University of California at Berkeley          |  somewhere."             |

gwyn@smoke.brl.mil (Doug Gwyn) (04/21/91)

In article <GNAT.91Apr20183721@kauri.kauri.vuw.ac.nz> gnat@kauri.vuw.ac.nz (Nathan Torkington) writes:
>What I am looking for is an explicit list of things which 0 stand for.

This is pretty pointless, isn't it?  A symbol can stand for whatever
you decide to make it stand for.

raymond@math.berkeley.edu (Raymond Chen) (04/21/91)

Zero is an enigmatic value.

It can mean success (fclose) or failure (scanf).

It can mean black or white.

It can mean no permissions (chmod) or all permissions (umask).

It can mean now (setjmp) or later (atexit).

It can mean the beginning (lseek) or the end (read).

It can mean myself (getpgrp) or child (fork).

It can mean all (kill's 1st argument) or nothing (kill's 2d argument).

It can mean `default' (SIG_IGN) or `I don't care' (waitpid) 
   or `try to guess' (strtol).

Indeed 0 lets you talk to God (setuid).

Verily is 0 all things to all people.

pjh@mccc.edu (Pete Holsberg) (04/24/91)

In article <1991Apr20.134839.11052@grebyn.com> ckp@grebyn.com (Checkpoint Technologies) writes:
=In article <GNAT.91Apr20183721@kauri.kauri.vuw.ac.nz> gnat@kauri.vuw.ac.nz (Nathan Torkington) writes:
=>I have read the FAQ and this doesn't seem to be what I'm after.  What I
=>am looking for is an explicit list of things which 0 (zero decimal, zero
=>octal, zero hexadecimal, etc) stand for.  So far I have :
=>  -> The number zero (in any base)
=>  -> The unused pointer (in some machines)
=       Er, really a pointer which is not pointing to anything.  This
=       should be true of all machines. (Go read the FAQ again.)
=>  -> The null character (ASCII, etc)
=>  -> End of file (EOF)
=       Actually this is untrue.  0 can be a valid file character, so EOF
=       must not be 0; typically EOF is -1.
=>  -> Not true (FALSE)
=
=Offhand, I can't think of any other "meanings" C gives to 0.

How about "These two strings are the same"?

Pete
-- 
Prof. Peter J. Holsberg      Mercer County Community College
Voice: 609-586-4800          Engineering Technology, Computers and Math
UUCP:...!princeton!mccc!pjh  1200 Old Trenton Road, Trenton, NJ 08690
Internet: pjh@mccc.edu	     Trenton Computer Festival -- 4/20-21/91