Created
November 12, 2014 08:52
-
-
Save dmikurube/76bca19c5735d2291ef6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#ifdef DECLARE_PRINTER_ | |
#error "The macro DECLARE_PRINTER_ is duplicated." | |
#else | |
#define DECLARE_PRINTER_(SECTION, VALUE_NAME) \ | |
void print_##SECTION##_##VALUE_NAME() { \ | |
printf("%s - %s\n", #SECTION, #VALUE_NAME); \ | |
} | |
#endif // DECLARE_PRINTER_ | |
DECLARE_PRINTER_(foo, bar); | |
DECLARE_PRINTER_(bar, baz); | |
#undef DECLARE_PRINTER_ | |
int main() { | |
print_foo_bar(); | |
print_bar_baz(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment