29-09-2016, 01:46 PM
Remember that any non-zero value will be considered as 'true' within a logical context, which can lead to surprises:
Rule 4-5-1 helps to enforce a consistent use of boolean types, helping to allowing defects to be detected.
Code:
a = 0x01u; // This is logically 'true'
b = 0x10u; // This is logically 'true'
if ( a & b ) // Result of bit-wise 'and' is 'false'
if ( a && b ) // Result of logical 'and' is true
<t></t>