Versions Compared

Key

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

...

The most severe problem with unsafe function-like macros is side effects of macro arguments, as shown in this noncompliant code example.:

Code Block
bgColor#FFcccc
langc
#define ABS(x) (((x) < 0) ? -(x) : (x))

void f(int n) {
  int m;
  m = ABS(++n);
  /* ... */
}

The invocation of the ABS()macro in this noncompliant code example expands to the following code. The resulting code has well-defined behavior , but causes n to be incremented twice rather than once, which may be surprising to those unfamiliar with the implementation of the macro or unaware that they are using a macro in the first place.

...

ToolVersionCheckerDescription

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

macrbody

Fully implemented.

Related Vulnerabilities

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

...