Question the "?"

[Based on "The ?: Operator Is An if Statement Too", pp 127 - 130 of Writing Solid Code by Steve Maguire.]

There is this great C/C++ operator ( ? : ) that most commonly is used as

a = ( b ? c : d );


return ( b ? c : d );

Which is all well and good as long as b, c and d are relatively simple. But when c and/or d contains the ?: operator, the clarity of ?: over and if statement begins to get lost.

With a good quality compiler (and you do use good quality tools) the potential code efficiency of nested ?: over nested if statements should not out weigh writing understandable and maintainable code.