☰
  • 首页
  • 规则分类
  • 项目介绍
search
•••

对常量的定义不应为引用

6.2.8 ID_constLiteralReference
目录 › next › previous

虽然 C++ 语言十分灵活,可以通过多种方式达到同一种目的,但应该选择最简洁且通俗易懂的方式实现。

示例:

const int& i = 1024;   // Non-compliant
const int&& j = 1024;  // Non-compliant

应改为:

const int i = 1024;  // Compliant
const int j = 1024;  // Compliant
Copyright©2024 360 Security Technology Inc., Licensed under the Apache-2.0 license.