Created
September 29, 2019 05:49
-
-
Save westfly/a9c0a80c609951acb99cbd5a0895e1dc to your computer and use it in GitHub Desktop.
debug宏定义的参数为lambda
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
#ifdef DEBUG | |
#define macro(labmda) \ | |
do { \ | |
labmda; \ | |
} while (0) | |
#define macro_call(labmda) \ | |
macro(labmda()) | |
#else | |
#define macro(labmda) | |
#define macro_call(labmda) | |
#endif | |
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
int x = 100; | |
macro([&]() { | |
printf("hello %d\n", x); }() | |
); | |
macro([](int x) { printf("hello %d\n", x); }(x)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment