Versions Compared

Key

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

...

The documentation for unsafe macros must warn about putting side effects on the invocation, and the responsibility is on the programmer using the macro. Because of the risks associated with their use, it is recommended that you avoid the creation of unsafe macro functions. See also PRE00-A. Prefer inline or static functions to function-like macros.

Non-Compliant Coding Example

...

A second, preferable, compliant solution is to declare ABS() as an inline function (see PRE00-A. Prefer inline or static functions to function-like macros).

Code Block
bgColor#ccccff
inline int abs(int x) {
  return (((x) < 0) ? -(x) : (x));
}
/* ... */
m = abs(++n);

...