--- In c-prog@yahoogroups.com, Rick <mowgl...@...> wrote: > > >My code is clearer and has > >a touch of elegance, vis-à-vis the bitwise operator. > > I don't see two strings, only one. Can you explain the "two strings" comment?
...and also why using the bitwise operator in your code gives it a touch of elegance ie. why is this: if (!f1 & !f2) f1=f2=1; more elegant than: if (!f1 && !f2) f1=f2=1; ? As far as I can tell they both give the same result, although the && might be more efficient because if !f1 is 0 then !f2 won't be evaluated. Using &, !f2 will always be evaluated (unless optimised out somehow?). Also, you are mixing logical (!) and bitwise (&) operators, which I would argue makes the code less clear - it looks like a bug. If you run the code through Gimpel's excellent PC/Flexe-Lint utility, you get: if (!f1 & !f2) Warning 514: Unusual use of a Boolean expression