Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!utcsri!flaps From: flaps@utcsri.UUCP Newsgroups: comp.lang.c Subject: Re: More writing readable code Message-ID: <5119@utcsri.UUCP> Date: Tue, 21-Jul-87 22:20:20 EDT Article-I.D.: utcsri.5119 Posted: Tue Jul 21 22:20:20 1987 Date-Received: Thu, 23-Jul-87 00:41:43 EDT References: <11128@hi.UUCP> Reply-To: flaps@utcsri.UUCP (Alan J Rosenthal) Organization: University of Toronto Lines: 30 Summary: In article <11128@hi.UUCP> kurt@hc.dspo.gov (Kurt Zeilenga) writes: >Often one might have two "boolean" variables, say a and b, and you would >like to know if A and B are both of the same truth value (zero or non-zero). >I have always done this like: > > (!A == !B) > >[which is not the same as (A == B)] Just thinking about how to express the idea "a and b are both either zero or non-zero", I think of the test as being whether or not their equalness to zero is equal. This yields "((a == 0) == (b == 0))". The problem, in my opinion, with your solution is that it looks like the '!'s can be removed (which of course would change the semantics). > "Remember, Mommie, I'm off to get a commie..." ^^^^^^^^ Isn't that "So, so long"?? -- // Alan J Rosenthal // \\ // flaps@csri.toronto.edu, {seismo!utai or utzoo}!utcsri!flaps, \// flaps@toronto on csnet, flaps at utorgpu on bitnet. "To be whole is to be part; true voyage is return."