c define multiline macro?

前端 未结 6 1424
滥情空心
滥情空心 2021-02-05 18:32
#define DEBUG_BREAK(a)\\
    if ((a)) \\
{\\
    __asm int 3;\\
}

I have defined a macro as above, and try to use it

#include \"test_d         


        
6条回答
  •  爱一瞬间的悲伤
    2021-02-05 19:25

    Rewrite it as an inline function:

    inline void DEBUG_BREAK(bool b)
    {
        if (b) 
        {
            __asm int 3
        }
    }
    

    You may want to replace __asm int 3 with DebugBreak(), as that is the official MS function to do this.

提交回复
热议问题