Skip to content
败犬日报 2025-11-06

败犬日报 2025-11-06

1. 非对齐访问

对于 C++ 来说,非对齐访问直接是未定义行为:

Attempting to create an object in storage that does not meet the alignment requirements of the object's type is undefined behavior. 尝试在存储中创建不符合对象类型对齐要求的对象是未定义行为。(ref)

对于硬件来说要看是什么处理器,比如 x86 和一些 arm 处理器支持。

2. BCD 码

8421BCD 码,每 4 bit 表示一个十进制位,是老古董。