Original Post
I was having a conversation in work the other day about style, and one of my workmates suggested that case statements can be made clearer. Instead of writing things like: if( Object.SomeFlagSet() ) { DoSomething(); } if( !Object.AnotherFlagSet() ) { DoSomethingElse(); } He would write: if( true == Object.SomeFlagSet() ) { DoSomething(); } if( false == Object.AnotherFlagSet() ) { DoSomethingElse(); } He argues that his version makes things more clearer to read, and I agree with him. I like code that is easy to read, however I'm worried about whether his style would add extra overhead? To me these statements are equivalent to: if( operator==( Object.SomeFlagSet(), true ) ) { DoSomething(); } if( operator==( Object.AnotherFlagSet(), false ) ) { DoSomethingElse(); } So wouldn't this lead to an extra temporary object and function call for each conditional statement? Or would this be compiled out by a decent compiler?