6 macros are setting my hair on fire rn Submitted by musou at June 8, 2022, 3:25 AM in programming 5 comments
2 flabberghaster wrote at June 8, 2022, 9:28 PM OK so this is kind of a pain in the neck to do a lot of times but sometimes you can get the output if the C preprocessor. Then through careful editing, you can kind of figure out what it's turning in to. int main(...) { WEIRD_MACRO(1, 2); } Then you could just put comments above and below it, and run cpp -I/all/include/directories main.c It will tell you the final output and also have debugging garbage about where each thing expanded from. Not ideal, and also in a big project that uses a complex build tool it can be incredibly hard to get the cpp args, but it can help. Reply Permalink
flabberghaster wrote
OK so this is kind of a pain in the neck to do a lot of times but sometimes you can get the output if the C preprocessor.
Then through careful editing, you can kind of figure out what it's turning in to.
Then you could just put comments above and below it, and run
cpp -I/all/include/directories main.c
It will tell you the final output and also have debugging garbage about where each thing expanded from.
Not ideal, and also in a big project that uses a complex build tool it can be incredibly hard to get the cpp args, but it can help.