Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!cmcl2!adm!xadmx!rbj@dsys.icst.nbs.gov From: rbj@dsys.icst.nbs.gov (Root Boy Jim) Newsgroups: comp.unix.questions Subject: Bit Switching - How? Message-ID: <19101@adm.BRL.MIL> Date: 12 Apr 89 15:17:25 GMT Sender: news@adm.BRL.MIL Lines: 26 ? From: Doug Gwyn ? In article <626@gonzo.UUCP> daveb@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?