Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!gatech!udel!mmdf From: ns@csd.cri.dk (Nick Sandru) Newsgroups: comp.os.minix Subject: NULL Message-ID: <57140@nigel.ee.udel.edu> Date: 25 Jun 91 11:51:53 GMT Sender: mmdf@ee.udel.edu Lines: 36 Exerpt from FAQ posting in comp.lang.c: --- Section 1. Null Pointers [...] 3. What is NULL and how is it #defined? A: As a matter of style, many people prefer not to have unadorned 0's scattered throughout their programs. For this reason, the preprocessor macro NULL is #defined (by or ), with value 0 (or (void *)0, about which more later). A programmer who wishes to make explicit the distinction between 0 the integer and 0 the null pointer can then use NULL whenever a null pointer is required. This is a stylistic convention only; the preprocessor turns NULL back to 0 which is then recognized by the compiler (in pointer contexts) as before. In particular, a cast may still be necessary before NULL (as before 0) in a function call argument. (The table under question 2 above applies for NULL as well as 0.) NULL should _only_ be used for pointers; see question 8. References: K&R I Sec. 5.4 pp. 97-8; K&R II Sec. 5.4 p. 102; H&S Sec. 13.1 p. 283; ANSI Sec. 4.1.5 p. 99, Sec. 3.2.2.3 p. 38, Rationale Sec. 4.1.5 p. 74. --- I will post the whole article if there is interest for it. Nick Sandru -- .signature waiting at the entry signal