wong@rtech.UUCP (J. Wong) (04/17/88)
Here's an interesting optimization (of which I'm sure some are already well aware :-) Occassionally, I write a conditional as follows: if ( ( a && b ) || ( !a && c && d ) ) error(); where "a" is often something like "version == 1". I dislike doing this because the condition "a" gets evaluated twice. I just realized I could rewrite this using the "?:" operator to only evaluate "a" once: if ( a ? ( b ) : ( c && d ) ) error(); (Depending on your compiler, this may not be more optimal.)