Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gitpyr.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!gitpyr!robert From: robert@gitpyr.UUCP (Robert Viduya) Newsgroups: net.lang.c Subject: Re: Cryptic C Message-ID: <685@gitpyr.UUCP> Date: Sat, 24-Aug-85 00:56:50 EDT Article-I.D.: gitpyr.685 Posted: Sat Aug 24 00:56:50 1985 Date-Received: Sun, 25-Aug-85 01:28:46 EDT References: <2913@ncsu.UUCP> <709@brl-tgr.ARPA> <1056@mtgzz.UUCP> <2076@ukma.UUCP> Organization: Georgia Tech, Atlanta Lines: 33 Summary: On what machine is (1==0) != 0 or (1==1) == 0? In article <2076@ukma.UUCP>, david@ukma.UUCP (David Herron, NPR Lover) writes: > In article <675@gitpyr.UUCP> robert@gitpyr.UUCP (Robert Viduya) writes: > > > > ... I personally prefer: > > > > #define TRUE 1 > > #define FALSE 0 > > typedef char bool; > > Well, I personally prefer: > > #define TRUE (1==1) > #define FALSE (1==0) > typedef char bool; > > Which is succint, to the point, and *machine*independant*! > Oh? On what machine is (1==1) equal to 0, or (1==0) not equal to 0? In section 7.6 (Relational operators, Appendix A - C Reference Manual from K&R's The C Programming Language), it explicitly states that the logical operators all yield 0 if the relation is false and 1 if the relation is true. Nothing is mentioned about possible variations due to implementation machine differences. robert -- Robert Viduya 01111000 Georgia Institute of Technology UUCP: {akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!robert {rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!robert BITNET: CCOPRRV @ GITVM1