Skip to content

败犬日报 2025-04-01

1. Compiler Options Hardening Guide for C and C++(教程)

https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html

2. 群友发现 auto_ptr 最有用的地方

yacc 的 union 要支持拷贝构造,但不允许自己增加函数,所以不能用 unique_ptr,只能用 auto_ptr

(auto_ptr 早已废弃,正常代码不要用)

3. 为什么 shared_ptr 没有 release

引用计数为零会销毁,如果提前用了 release(且引用计数大于 1)就会重复销毁。