c++ - cppcheck 为 "Redundant code: Found a statement that begins with numeric constant"语句报告 'using'

标签 c++ c++11 boost cppcheck

了解这不是大量的上下文,我有这一行:

using GridType = Grid<boost::optional<float>, 2>;

cppcheck 说:

Redundant code: Found a statement that begins with numeric constant.

我会认为是“误报”,但通常这些分析工具比我聪明,所以我想看看是否有人能想到为什么分析器会这样解释这样的陈述?

我在 Ubuntu 系统上使用 cppcheck 1.61。

最佳答案

cppcheck 主要基于模式匹配,有时不太聪明/很肤浅。它确实找到了很多不错的东西,但也有很多误报。我会说这是一个误报,cppchecks 简单的头脑感到困惑。

还有; 1.61 版本有点旧。你有没有测试过最新的1.74,看看它在这里是否更聪明? (如果它不在您的发行版存储库中,则从源代码构建非常简单)

关于c++ - cppcheck 为 "Redundant code: Found a statement that begins with numeric constant"语句报告 'using',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38639471/

相关文章:

c++ - DR 2137 我不清楚

c++ - glRotatef 没有按预期旋转

c++ - Constexpr 变量在 Lambda 内部显示为未初始化

c++ - 调用复制 ctor 而不是移动 ctor

c++ - 卡在 boost 邻接列表清除

c++ - 如何同时使用boost auto_cpu_timer和progress_display?

c++ - 无法覆盖继承的静态常量成员

c++ - 将 boost::make_recursive_variant 与元组一起使用

c++ - 使用/clr 在 Visual Studio 2010 中 boost

boost 灵气 : Is it suitable language/tool to analyse/cut a "multiline" data file?