Bit Switching - How?

Root Boy Jim rbj at dsys.icst.nbs.gov
Thu Apr 13 01:17:25 AEST 1989


? From: Doug Gwyn  <gwyn at smoke.brl.mil>

? In article <626 at gonzo.UUCP> daveb at gonzo.UUCP (Dave Brower) writes:
? RBJ>>		x ^= z, y^= z;		/* flip those that do */
? -		x ^= z; 		/* flip those that do */
? -		y^= z;
? -If you don't see _why_ this is the right way, you'd better not work on a
? -project with anyone but yourself.

? Hey, now, it's not all that clear cut.  Conceptually the two
? assignments should occur in parallel; for some people using , to
? separate such assignments is the "natural" way to express that.

Yeah, but unless ANSI changed the meaning of ",", they evaluate
left to right. I stand by my original use of the comma operator.
Some people may not like it, but it's legal C. Some people go
so far as to write "if (z != 0)" instead of "if (z)". This used to
bother me, but it's really a matter of style/religion.

To make Dave Brower really barf, I've started writing my simple
if statements as: "condition && statement". Comes from LISP I suppose.

Hey, I gave up the C newsgroup, don't chase me with it.

	Root Boy Jim is what I am
	Are you what you are or what?



More information about the Comp.unix.questions mailing list