返回> 网站首页 

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

yoours2009-06-18 12:58:55 阅读 1228

简介一边听听音乐,一边写写文章。

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.编译工程,(无论工程是否能编译成功都)会输出上面的注释,然后双击注释,定位到代码处


微信小程序扫码登陆

文章评论

1228人参与,0条评论