TRUE and FALSE

John Baldwin johnb at srchtec.UUCP
Sat Sep 1 07:19:59 AEST 1990


In article <3835 at sactoh0.SAC.CA.US> jak at sactoh0.SAC.CA.US
 (Jay A. Konigsberg) writes:
>
>Personally though, I like the following:
>
>#define TRUE -1
>
>Why? Because of the following 8 bit pattern:
>
> 1: 01111111
>-1: 11111111

Aaaiigh!  Never... NEVERNEVERNEVERNEVER *ever*
   assume 1's-complement, 2's-complement, and so on!

The exception to this is when writing very machine-specific code which you
already *know* isn't going to be portable anyway.  Even then, there are
some tricks to isolate yourself from the architecture, without giving up
much.


P.S.  what architecture gives 1(decimal) == 01111111 (binary) ???

-- 
John T. Baldwin                      |  johnb%srchtec.uucp at mathcs.emory.edu
Search Technology, Inc.              | 
                                     | "... I had an infinite loop,
My opinions; not my employers'.      |  but it was only for a little while..."



More information about the Comp.lang.c mailing list