Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!mcsun!hp4nl!gufalet.let.rug.nl!rug4!laverman From: laverman@cs.rug.nl (Bert Laverman) Newsgroups: comp.os.minix Subject: Re: NULL Message-ID: <1991Jun23.203751.13653@cs.rug.nl> Date: 23 Jun 91 20:37:51 GMT References: <33822@usc.edu> Sender: laverman@cs.rug.nl Organization: Dept. of Computing Science, University of Groningen Lines: 36 In article <33822@usc.edu> kjh@pollux.usc.edu (Kenneth J. Hendrickson) writes: >*** BUG FIX *** > >In /usr/include/stdio.h, #define NULL 0 >In /usr/include/*.h (all others), #define NULL ((void *)0) > >stdio.h should be updated asap. > >If I'm wrong about this, or if this will break anything, please let me >know. There is some controversy on this. ACK is a real K&R compiler, and thus ((int)0) (sorry for the explicit int, but I want to make a point) is the only acceptable NULL 'anypointer'. For ANSI C (void *) pointers can be used as generic pointers, in the sense that any pointer is casted to this one without complaint. (The other way around is dangerous, and _should_ give a warning) ACK C knows about the void type, but it doesn't really understand NULL as ((void *)0). It generates endless amounts of warnings about 'illegal pointer combination's. Now, since ACK is K&R, the integer NULL is correct. BUT (a big one): 68k ACK uses pointers of 32, and ints of 16 bits. Giving an integer NULL as parameter to a procedure will get you in trouble (to say the least). Isn't there a commandment on this? something like: - thou shalt cast al parameters of a procedure to the expected type lest horrible thing happen. I don't remember the correct wording, but it's not for fun! Greetings, Bert -- #include Bert Laverman, Dept. of Computing Science, Groningen University laverman@cs.rug.nl bert@arrakis.nl.mugnet.org