Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!bbn!mit-eddie!rutgers!dayton!joe From: joe@dayton.UUCP (Joseph P. Larson) Newsgroups: comp.sys.amiga.tech Subject: Re: Ultimate Wait-GetMsg strategy (?) Message-ID: <6445@dayton.UUCP> Date: 7 Mar 89 14:45:47 GMT References: <8902100658.AA16049@postgres.Berkeley.EDU> <6777@polya.Stanford.EDU> <6402@dayton.UUCP> <331@wn2.sci.kun.nl> <562@ivucsb.UUCP> Reply-To: joe@dayton.UUCP (Joseph P. Larson) Organization: Dayton-Hudson Dept. Store Co. Lines: 25 >In article <331@wn2.sci.kun.nl> janhen@wn2.sci.kun.nl (Jan Hendrikx) writes: >|(!expr) means the same as (expr != 0), which is THE test to test for a >|NULL pointer. Even if NULL pointers are internally not represented by >|all-bits-zero, the compiler must recognize a comparison between a >|pointer and the constant 0, and emit approprate code in case that that >|compiler's internal representation of a NULL pointer is not the same >|as 0. Irregardless of whether this works or not, it is better style to compare against NULL, a value that indicates a pointer to nowhere. What if address zero is a legal address? NULL might be -1 then. You don't know how some odd machine is going to work in the future. So THE test for comparing a pointer against NULL is to compare it against NULL, not to depend on what NULL's value might be. !expr or expr == 0 works, but that is simply because on most machines, NULL is going to be zero. -J -- When you fall on your head do you land on your feet? UUCP: rutgers!dayton!joe (Feed my Dayton Hudson Department Store Company ATT : (612) 375-3537 picture Joe Larson/MIS 1060 (standard disclaimer...) collection) 700 on the Mall Mpls, Mn. 55402