Versions Compared

Key

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

...

Code Block
bgColor#FFcccc
langc
int x, y, z, tmp;
if (z == 0)
  SWAP( x, y);

It expands to the following, which is certainly not what the programmer intended:

...

Code Block
bgColor#FFcccc
langc
/*
 * Swaps two values and requires
 * tmp variable to be defined.
 */
#define SWAP(x, y) { tmp = x; x = y; y = tmp; }

...

Code Block
bgColor#FFcccc
langc
if (x > y)
  SWAP(x, y);          /* Branch 1 */
else  
  do_something();     /* Branch 2 */

...

Related Guidelines

...