Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!labrea!aurora!ames!sdcsvax!ucbvax!jade!eris!mwm From: mwm@eris.BERKELEY.EDU (Mike (My watch has windows) Meyer) Newsgroups: comp.sys.amiga Subject: Re: Manx C Message-ID: <4628@jade.BERKELEY.EDU> Date: Wed, 31-Dec-69 18:59:59 EDT Article-I.D.: jade.4628 Posted: Wed Dec 31 18:59:59 1969 Date-Received: Sat, 8-Aug-87 19:22:09 EDT References: <4540@jade.BERKELEY.EDU> <1836@vax135.UUCP> <4595@jade.BERKELEY.EDU> <3199@zen.berkeley.edu> <17827@amdcad.AMD.COM> <3211@zen.berkeley.edu> Sender: usenet@jade.BERKELEY.EDU Reply-To: mwm@eris.BERKELEY.EDU (Mike (My watch has windows) Meyer) Distribution: comp Organization: Missionaria Phonibalonica Lines: 88 Keywords: look at the assembly. In article <3211@zen.berkeley.edu> waterman@cory.Berkeley.EDU.UUCP (T.S. Alan Waterman) writes: < What I don't get is this-- (!ptr) seems more straightforward, < you never have to worry about types, and it makes smaller code < than (ptr == 0) anyway. Why use the second expression? (with < pointers, at least.) No, !ptr is *not* more straightforward. I read that as "if ptr is false". Huh? Pointers aren't booleans - they don't take on true or false values. On the other hand, !ptr can be read as "if ptr not valid", which makes some sense. I don't like it, but I'm not dogmatic about it. That !ptr generates smaller code on Manx is probably related to Manx not handling "ptr == 0" correctly. On a compiler that does things right (4.3BSD pcc), I put in: main() { char *x ; if (x == 0) ; if (!x) ; } and get out (for the important part): L15: tstl -4(fp) jneq L16 L16: tstl -4(fp) jneq L17 L17: In other words, you get the exact same code from either case. I expect Lattice to do the same, and will try to remember to test it when I get home. < I really don't want to turn this into a war, but I have to disagree, at