Cryptic C
Robert Viduya
robert at gitpyr.UUCP
Sat Aug 24 14:56:50 AEST 1985
In article <2076 at ukma.UUCP>, david at ukma.UUCP (David Herron, NPR Lover) writes:
> In article <675 at gitpyr.UUCP> robert at 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
More information about the Comp.lang.c
mailing list