Comments (2)
这条规则可以商榷的地方很多。
- 构造异常对象(排除复制构造本身)本身确实可能抛出异常,而且这种情况下会丢失原来的异常上下文。本建议具有事实上的合理性。
- 考虑
std::bad_alloc
并未合理地对该异常到底属于逻辑错误还是运行时错误进行归类,尤其是 Linux OOM killer 生效之情形,std::bad_alloc
几乎就完全是由于输入错误导致的(例如my_string.resize(-1UL)
)。 what()
应为noexcept
。
from safe-rules.
收到~ 这个问题确实值得重点强调,ID_exceptionInException 的本意也包含拷贝构造函数,但说得不是很明白,我们下个版本会将这个问题列为单独的一个规则,谢谢~
from safe-rules.
Related Issues (20)
- 递归调用析构函数是UB
- C 头文件名不应被视为过时的 HOT 2
- R2.22 存在覆盖不完全的问题 HOT 3
- C++20 移除了“对有符号整数进行超出取值范围的左移运算”导致的未定义行为 HOT 1
- 修改“空指针”定义 HOT 1
- R5.1.21 "存在构造、析构的类" 描述不明确 HOT 2
- R2.20 windows 无法使用 `alloca.h` 标头 HOT 1
- `R14.18` 的观点非常值得商榷,且解释并不合理 HOT 3
- R1.2 中"避免避免敏感数据写入内存转储文件" 多了一个 "避免" HOT 1
- R2.15 中 "用 new 分配的数组" 是否考虑改为 "用 new[] 分配的数组" HOT 1
- “`R6.4.2` 禁用可变参数列表“中使用模板参数包的示例过时且糟糕,应该使用折叠表达式 HOT 1
- `Apache2.0` 开源协议不声明版权所有者吗? HOT 1
- `R8.41` 中对内联函数的描述不正确 HOT 3
- `R14.24` “指针运算应使用数组下标的方式” 是否没考虑 `p[0]`、`*p` HOT 8
- `SIG_ATOMIC_MIN` 与 `SIG_ATOMIC_MAX` 的问题 HOT 1
- `R2.9` “对象被移动后不应再被使用”描述与规则可以改进 HOT 1
- `R3.2.8` “不应使用宏定义常量” 中的正确示例可以改进 HOT 1
- `R2.1` “不可失去对已分配资源的控制”线程 `detach` 理论上也算失去了控制? HOT 1
- `R3.1.2` “include 指令中禁用不合规的字符”中的建议描述,不妥 HOT 2
- `cpp-ub-list` `55.` 空指针解引用 HOT 31
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from safe-rules.