Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site harvard.ARPA Path: utzoo!linus!vaxine!wjh12!harvard!elvy From: elvy@harvard.ARPA (Marc Elvy) Newsgroups: net.unix-wizards,net.lang.c Subject: Using NULL as an illegal pointer Message-ID: <311@harvard.ARPA> Date: Sun, 1-Jul-84 17:38:14 EDT Article-I.D.: harvard.311 Posted: Sun Jul 1 17:38:14 1984 Date-Received: Tue, 10-Jul-84 04:33:25 EDT References: <1273@sri-arpa.UUCP>, <4011@utzoo.UUCP> Organization: Aiken Computation Lab, Harvard Lines: 26 While it does not seem to be standard practice in the UNIX world, all of the C programmers (systems programmers or otherwise) here have been encouraged to adopt explicit casting of NULL. Sure, 0 is defined to be an illegal pointer, and every implementation of NULL which I have ever seen has it equal to 0, but just in case there exists a machine on which NULL is not an untyped (multityped?) entity, we cast everything. Besides, it is good documentation, and does not break anything. So my vote goes for char *string = (char *) NULL; and return ((char *) NULL); and return ((struct struct_name *) NULL); etc. rather than char *string = NULL; and return (NULL); Marc Marc A. Elvy ( elvy@harvard.{arpa,uucp} ) Aiken Computation Laboratory Harvard University