Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: fixed up a bit

...

This noncompliant code example also contains inadequately bounds multiple , unbound statements.

Code Block
bgColor#ffcccc
/*
 * Swaps two values.
 * Requires tmp variable to be defined.
 */
#define SWAP(x,y) { int tmp; tmp=x; x=y; y=tmp; }

This macro fails to expand correctly in some case such as the following example which is meant to be an if-statement with two branches:

...

Code Block
bgColor#ffcccc
if (x > y) {          /* Single-branch if-statement!!! */

  int tmp;         = x;   /* The one and only branch consists */
  tmpx = xy;            /* of the block. */
  x = y;
  y = tmp;
}
;                           /* empty statement */
else                        /* ERROR!!! "parse error before else" */
  do_something();

...