c define multiline macro? -


#define debug_break(a)\     if ((a)) \ {\     __asm int 3;\ } 

i have defined macro above, , try use

#include "test_define.h" int main() {     debug_break(1 == 1);     return 0; } 

but sample not compile. compiler complain parenthesis not closed. if add } in end of source file, compiles.

what's wrong macro?

the macro

#define debug_break(a)\     if ((a)) \     __asm int 3; 

works fine

#define debug_break(a)\     if ((a)) \ {\     __asm int 3;\ } 

doesn't! , think guess why!! new line operator problem making guy!

it takes

 __asm int 3;\ } 

as

__asm int 3; } 

where ; comments out follows (in assembly). miss } then.


Comments