#define line of code to something else

c, c++

Solution

You could do a global search and replace with your programming editor (or IDE) of choice and change `_asm int 3` to e.g. `FOO`, and then define a macro `FOO` like this:

#if 1 // <<<- change this test to determine how `FOO` is expanded
  #define FOO _asm int 3
#else
  #define FOO exit(1)
#endif

Problem

Is it at all possible in c/c++ to do something like to following: ``` #define (_asm int 3;) (exit(1)) ``` So that everywhere in my code this line will be replaced at compile time. I know this is bad practice but is it possible. cheers

Original source