Created
June 23, 2012 08:01
-
-
Save pghalliday/2977484 to your computer and use it in GitHub Desktop.
Macro notes
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
| #define MY_MACRO(FUNCTION_NAME, FORMAT, ARGS...) FUNCTION_NAME(FORMAT , ##ARGS) |
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
| #define _MY_MACRO(FORMAT, ARGS...) O_debug(FORMAT , ##ARGS) | |
| #define MY_MACRO(FORMAT, ARGS...) _MY_MACRO(FORMAT , ##ARGS) | |
| #define FORMAT "Hello, %s!\n" | |
| MY_MACRO(FORMAT, "world"); |
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
| #define __MY_MACRO(FORMAT, ARGS...) O_debug(FORMAT , ##ARGS) | |
| #define _MY_MACRO(FORMAT, ARGS...) __MY_MACRO(FORMAT , ##ARGS) | |
| #define MY_MACRO(ARGS...) _MY_MACRO(STANDARD_FORMAT , ##ARGS) | |
| #define STANDARD_FORMAT "Hello, %s!\n" | |
| MY_MACRO("world"); | |
| MY_MACRO("other worlds"); | |
| #undef STANDARD_FORMAT | |
| #define STANDARD_FORMAT "Goodbye, %s!\n" | |
| MY_MACRO("world"); | |
| MY_MACRO("other worlds"); | |
| #undef STANDARD_FORMAT |
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
| #define MY_MACRO(FUNCTION_NAME, ARGS...) FUNCTION_NAME(ARGS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment