31-03-2006, 07:20 PM
Is the usage of ternary operator (? :) inside a C macro violation of rule 19.4. For e.g. the following function-like macro
#define abs(x) (((x) >= 0) ? (x) : -(x))
According to Rule 19.4 - C macros shall only expand to a braced initialiser, a constant, a parenthesized expression, a type qualifier, a storage class specifier or a do-while construct.
Does the above function-like macro conform to rule 19.4?
#define abs(x) (((x) >= 0) ? (x) : -(x))
According to Rule 19.4 - C macros shall only expand to a braced initialiser, a constant, a parenthesized expression, a type qualifier, a storage class specifier or a do-while construct.
Does the above function-like macro conform to rule 19.4?
<t>--------------------------------------------------------<br/>
Aravind Pillarisetti<br/>
The MathWorks<br/>
--------------------------------------------------------</t>
Aravind Pillarisetti<br/>
The MathWorks<br/>
--------------------------------------------------------</t>