I want to be able to:
#define DEBUG_MODE 1
In order to turn on and off the printf()
function calls inside all of my code. I know how to do this if it's set up as such:
if (DEBUG_MODE) printf("Hello World\n");
However, that takes foresight and setting it up line by line.
Is there like a find and replace feature within macros that exists or can be built that can replace a given expression - like printf();
- with an empty string (or anything else you might want)?
#define DEBUG_MODE replace("printf(some_regular_expression);", ""); // where "" is empty string
I'm sure this is not possible let alone with regex, but it doesn't hurt to ask.