从reddit/hackernews/lobsters/meetingcpp摘抄一些c++动态。
每周更新
欢迎投稿,推荐或自荐文章/软件/资源等,请提交 issue
-fno-semantic-interposition优化-fpic的,讲这个flag的逻辑以及在gcc/clang中的效果.TODO: 没有看懂
Mostly harmless: An account of pseudo-normal floating point numbers
介绍了float的格式以及可能引入的CVE?TODO:没有看懂
LLVM Internals: Independent Code Generator
大概介绍一下llvm原理
It compiles does not always means that it works
继承 基类记得写override,重构的时候帮你发现继承可能出现错误
A Default Value to Dereference Null Pointers
用std::optional来包装指针类型,然后用value_or来访问
c++ tip of week 225Did you know about C++23 feature which removes unnecessary ()’s from C++ lambdas?
新提案可以去掉lambda多余的括号
int main() {
constexpr auto okay_in_cpp20 = [] {}; // okay in C++20
constexpr auto error_in_cpp20 = [] mutable {}; // okay in C++23
constexpr auto error_in_cpp20 = [] -> int { return {};}; // okay in C++23
}
benchmark显示clear要比赋值快很多很多, 主要是赋值造成的开销