Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This compliant solution follows the guidance of PRE00-C. Prefer inline or static functions to function-like macros by defining an inline function iabs() to replace the ABS() macro. Unlike the ABS() macro, which operates on operands of any type, the iabs() function will truncate arguments of types wider than int whose value is not in range of the latter type.

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

Key here (explains table format and definitions)

SEI Coding Standard

Taxonomy

Taxonomy item

Relationship

CERT CPRE00-C. Prefer inline or static functions to function-like macrosPrior to 2018-01-12: CERT: Unspecified Relationship
CERT CPRE12-C. Do not define unsafe macrosPrior to 2018-01-12: CERT: Unspecified Relationship
CERT CMSC14-C. Do not introduce unnecessary platform dependenciesPrior to 2018-01-12: CERT: Unspecified Relationship
CERT CDCL37-C. Do not declare or define a reserved identifierPrior to 2018-01-12: CERT: Unspecified Relationship
CERT CSEI CERT C++ Coding StandardPRE31-CPP. Avoid side-effects in arguments to unsafe macrosPrior to 2018-01-12: CERT: Unspecified Relationship
CERT Oracle Secure Coding Standard for JavaEXP06-J. Expressions used in assertions must not produce side effectsPrior to 2018-01-12: CERT: Unspecified Relationship
ISO/IEC TR 24772:2013Pre-processor Directives [NMP]Prior to 2018-01-12: CERT: Unspecified Relationship
MISRA C:2012Rule 20.5 (advisory)Prior to 2018-01-12: CERT: Unspecified Relationship

Bibliography

[Dewhurst 2002]Gotcha #28, "Side Effects in Assertions"
[ISO/IEC 9899:2011]Subclause 6.5.1.1, "Generic Selection" 
[Plum 1985]Rule 1-11

...