让你团队里所有人在编译工程时都要看你的代码注释

1.在xxxx.h中定义宏如下:#ifndef PRO_MSG
        #define __PRO_STR(x)                #x
        #define __PRO_STR2(x)                __PRO_STR(x)
        #define PRO_MSG(desc)                message(__FILE__ "(" __PRO_STR2(__LINE__) "): " desc)
#endif


#ifndef prompt
        #define prompt(desc)                PRO_MSG(desc)
#endif


2.然后在stdafx.h中#include "xxxx.h"


3.在xxxx.cpp中,你看到一句代码很不爽,给它加个注释
#include "stdafx.h"
void SomeFun(double a)
{
pragma prompt("这句代码谁写的,脱出去TJJTDS...")
        if (0.5 == a)
        {
                // do something
        }
}


4.编译工程,(无论工程是否能编译成功都)会输出上面的注释,然后双击注释,定位到代码处


上一篇:Intel Xeon Gold 6149 3.1GHz CPU性能怎么样?阿里云ECS服务器


下一篇:PHP开发的一些漏洞安全知识