Paul Eggert <eggert <at> CS.UCLA.EDU> writes: > Furthermore, bitwise operators often generate shorter and faster code, > particularly on modern processors where conditional branches are far > more expensive than logical operations. For example, consider these > functions: > > bool F (bool a, bool b, bool c, bool d) { return a && b && c && d; } > bool G (bool a, bool b, bool c, bool d) { return a & b & c & d; }
Are we feeding these as bug reports to the gcc folks? This seems like something they should be aware of, in that if there are no side effects in evaluating the four boolean variables, the compiler should be generating identical code for either choice of operator. If we can get the compiler fixed, then I'd lean towards using && notation. -- Eric Blake