|Synopsis:||The convenience of the conditional operator should be weighed against the clarity of the code.|
The interaction of the conditional operator with the precedence of other operators causes confusion for many novice programmers. If the second or third operand is a non-atomic expression it is clearer to use an if statement instead of the ? : operators. Hence,
len = (ac_DataLength <= 3) ? ac_DataLength : 3;
is allowed, but the following construction is not accepted.
len = (ac_DataLength <= 3) ? (ac_DataLength + 1) : 3;