Boolean Operators Slighted in C

KW Heuer kwh at bentley.UUCP
Mon May 5 23:37:54 AEST 1986


In article <778 at bentley.UUCP> I wrote:
>A true boolean datatype would have a couple of advantages:
>
>o  Multiple flag variables with local scope and no address operator (e.g.
>   variables declared "register bool") could be packed into a single word.
>
>o  "++x" and "--x" could be defined as "set" and "clear"; "x++" and "x--"
>   would then be "test and (set|clear)".  This would obviate such things as
>   "if (!flag) { flag=1; printmsg(); }".

I forgot to mention one other:

o  A function returning a bool could be implemented on some machines by
   setting the condition codes instead of storing a full integer value in
   the return register.

Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint



More information about the Comp.lang.c mailing list