Skip to content
败犬日报 2025-12-09

败犬日报 2025-12-09

1. 模板特化会“继承”主模版的存储期

cpp
template <typename T>
static void foo();

template <>
static void foo<int>() {}  // error: explicit template specialization cannot have a storage class

特化的存储期都是跟主模板一样的,不重复写,都是直接“继承”主模板的。

2. 16 bit 一字节的平台

https://wg21.link/p3633

这也会导致基本类型的 sizeof 和主流平台差别很大。