^^, ====, and other kludges

moroney at jon.DEC moroney at jon.DEC
Wed Dec 12 02:42:30 AEST 1984


It seems to me that all this discussion about new operators such as ^^ is all
caused by an oversight in the implementation of (actually lack of) booleans in
C.  If C had a strict rule that 0 is false, 1 is true and well, anything else,
you take your chances, there would not be any need for any new operators like
^^.  If the only legal value of TRUE is 1, ^^ evaluates the same as ^ in all
cases, so ^^ would be unnecessary.  Also, the only difference between && and &
would be whether the second operation would always be evaluated or not. If the
definition of ! were the same (!0==1, !anythingelse==0) then the old definition
of non-zero =true could still be used by using !!x (or x!=0) which gives TRUE
(or 1) if x!=0 and FALSE (0) if x==0.  Also a one-bit new type (boolean or
logical) could be created that used only 1 bit to determine TRUE or FALSE,
allowing the use of huge arrays of booleans using little memory. (Admittedly
not very common) 

"There's a madness to my method."		Mike Moroney
					..!decwrl!rhea!jon!moroney



More information about the Comp.lang.c mailing list