Simple ways to disable parts of code

后端 未结 14 1160
误落风尘
误落风尘 2021-01-31 08:59

This isn\'t a typical question to solve a specific problem, it\'s rather a brain exercise, but I wonder if anyone has a solution.

In development we often need to disable

14条回答
  •  暖寄归人
    2021-01-31 09:10

    Macro is the way to do this..

    #define COMPILE 
    
    #ifdef COMPILE
    
    //code to comment begins
    cout<<"ha ha ha"<

    To disable the code, just comment out #define compile line

提交回复
热议问题