Versions Compared

Key

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

...

DCL01-C-EX2: A temporary variable within a new scope inside of a macro can override a surrounding identifieroverride an identifier in a containing scope. This does not apply to to the arguments of the macro itself.

Code Block
bgColor#ccccff
langc
#define SWAP(type, a, b) do { type tmp = a; a = b; b = tmp; } while(0)
 
void func(void) {
  int tmp = 100;
  int a = 10, b = 20;
  SWAP(int, a, b); /* Hidden redeclaration of tmp is acceptable */
}

...