Time to standardize "true" and "false"

Norman Diamond diamond at csl.sony.co.jp
Fri Sep 29 14:17:18 AEST 1989


>From article <12070 at cit-vax.Caltech.Edu>, by wen-king at cit-vax.Caltech.Edu (King Su):

>> #define bool(a) (!!(a))
>> Then just use bool(X) whenever you wanted to use (bool)X.

In article <8862 at etana.tut.fi> pl at etana.tut.fi (Lehtinen Pertti) writes:

>	Then suddenly just behind the corner comes C-compiler from
>	ACME-corporation and realizes '!!a' -> negation of negation is
>	same as original -> we can optimize it away.

Actually no.  If the optimizer reduces this to a no-op without knowing
that "a" must already be 0 or 1, then the optimizer is broken.  "!"
was required to produce a result of 0 or 1 even before K&R-1.

-- 
Norman Diamond, Sony Corporation (diamond at ws.sony.junet)
  The above opinions are inherited by your machine's init process (pid 1),
  after being disowned and orphaned.  However, if you see this at Waterloo or
  Anterior, then their administrators must have approved of these opinions.



More information about the Comp.lang.c mailing list