是否有任何静态分析工具可以检查规则 3(或规则 5 C++11) [英] Are there any static analysis tools that check for Rule of 3 (or Rule of 5 C++11)

查看:23
本文介绍了是否有任何静态分析工具可以检查规则 3(或规则 5 C++11)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个建立在沙子基础上的代码库.

I am currently working on a codebase that is built on a foundation of sand.

据称经过测试的库中有许多违反3 法则"的类.大多数声明了一个非平凡的析构函数,但缺少复制构造函数或赋值运算符.

There are numerous classes in supposedly tested libraries that violate the "Rule of 3". Most declare a non-trivial destructor, but are missing either a copy constructor or assignment operator.

是否有任何编译器标志 (gcc) 或静态分析工具会在类违反 3 规则时发出警告?

Are there any compiler flags (gcc) or static analysis tools that warn when a class violates the rule of 3?

目前我们在 GCC 4.4 版中使用 Coverity.

Currently we are using Coverity with GCC version 4.4.

推荐答案

Coverity 有.我们使用 6.5 版.有一个检查器 MISSING_COPY_OR_ASSIGN.

Coverity has. We use version 6.5. There is a checker MISSING_COPY_OR_ASSIGN.

这篇关于是否有任何静态分析工具可以检查规则 3(或规则 5 C++11)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆