use*_*108 -1 c++ memory-alignment type-punning
在我的自定义.zip解压缩器中,我得到这样的警告:
runtime error: load of misaligned address 0x7f280ffe875a for type 'const uint32_t', which requires 4 byte alignment
Run Code Online (Sandbox Code Playgroud)
究其原因是reinterpret_cast对uint32_t*和相同的解引用.我知道,memcpy到uint32_t会解决这个问题,但我要这么做?我看到许多广泛使用的库(如pixman,cairo ......)都有同样的警告.