No Such Thing

Ken Montgomery kjm at ut-ngp.UTEXAS
Wed Aug 28 04:50:29 AEST 1985


From: barmar at mit-eddie.UUCP (Barry Margolin)

>To me, the mapping TRUE -> 0 and FALSE -> non-zero doesn't seem obvious,
>and I'm sure it isn't to most programmers who ever worked in assembler.

Not to me, at least.  I write nearly nothing but assembler code (using
a UNIX fullscreen editor I wrote, in C).  I have no trouble going
between C and assembler.  In assembler, truth is what you make it. :-)

> [...]  No such memory is needed for the
>assembler, of course, since comparison is merely done by subtraction,
> [...] so it is obvious what the zero indicator
>means.  It is not so obvious to me that in C 0 should mean false and 1
>mean true.

All of my flag variables in assembler are 'true' when non-zero.
I prefer this convention because the obvious 'true' value when
working with packed flag fields is 1.  Also, I'm no great fan of
doing negative logic in software, which is what you get when you
make 'true' be 0.

>-- 
>    Barry Margolin
>    ARPA: barmar at MIT-Multics
>    UUCP: ..!genrad!mit-eddie!barmar

--
The above viewpoints are mine.  They are unrelated to
those of anyone else, including my cat and my employer.

Ken Montgomery  "Shredder-of-hapless-smurfs"
...!{ihnp4,allegra,seismo!ut-sally}!ut-ngp!kjm  [Usenet, when working]
kjm at ngp.{UTEXAS.EDU, ARPA}  [Pick one.  It might work.]



More information about the Comp.lang.c mailing list