我们的项目真的很大.源代码大小在一个模块中约为620KLOC.所以我想检查目录/模块中哪个函数最大?有没有工具可以支持它?
SourceMonitor只有"每个方法的平均语句",而不是每个方法的最大语句.CCCC也不支持它.
例.此函数长度为1.
unsigned short get()
{
return 1;
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
Jenkins 中的一项工作调用我的 python 脚本,我想在其中调用make以编译我的 UT 代码,并sys.exit(1)在出现诸如“make: *** [ ] Error 1”之类的编译错误时引发。
我还需要实时打印输出。
这是我的python脚本:
make_process = subprocess.Popen("make clean all;", shell=True, stdout=subprocess.PIPE, stderr=sys.stdout.fileno())
while True:
line = make_process.stdout.readline()
if not line:break
print line, #output to console in time
sys.stdout.flush()
Run Code Online (Sandbox Code Playgroud)
但是如何捕获make错误并让这个 python 脚本失败?
笔记:
更新: 原来是一个makefile问题。请参阅对已接受答案的评论。但是对于这个python问题,pentadedecagon给出了正确的答案。
我有提升变体类型定义:
typedef boost::variant< bool, int, float, double> VariantType;
Run Code Online (Sandbox Code Playgroud)
我想对它实现加/减/乘/除动作.以Add class为例.问题是如果在VariantType中添加新类型,例如std :: string,则必须使用新类型更新Add类.
struct Add : public boost::static_visitor<VariantType> {
template <typename T>
T operator() (T a, T b) const {
return a + b;
}
float operator() (int a, float b) const {
return a + b;
}
float operator() (float a, int b) const {
return a + b;
}
double operator() (int a, double b) const {
return a + b;
}
double operator() (double a, int …Run Code Online (Sandbox Code Playgroud)