Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created July 28, 2020 10:30
Show Gist options
  • Save kaityo256/0158797da02165bdd9ede6d4fa8e29c0 to your computer and use it in GitHub Desktop.
Save kaityo256/0158797da02165bdd9ede6d4fa8e29c0 to your computer and use it in GitHub Desktop.
Redefined macro
#include <cstdio>
#define A(x, y) x + y
#define A(x, y) x +y //test.cpp:4:0: warning: "A" redefined
int main() {
printf("%d\n", A(1, 2));
}
@kaityo256
Copy link
Author

$ g++ test.cpp
test.cpp:4:0: warning: "A" redefined
 #define A(x, y) x +y //test.cpp:4:0: warning: "A" redefined

test.cpp:3:0: note: this is the location of the previous definition
 #define A(x, y) x + y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment