如果是未对齐的指针类型,编译器会报告警告(在itanium的VLIS架构下报错)。为了避免这种情况,使用__unainged 修饰指针。如:void __unaligned* p;
__unainged 如何工作的:
inserting additional checks to detect the unaligned case, and loading/storing parts of the object that straddle the alignment boundary separately. That is even slower than unaligned access on platforms which natively support it, however。
翻译:
通过插入额外的检查来检测非对齐情况,并分别加载/存储跨越对齐边界的对象部分。这甚至比原生支持它的平台上的非对齐访问还要慢。

博客讨论了在特定架构如itanium的VLIS中,未对齐指针会导致编译警告。解决方法是使用`__unaligned`关键字,但这可能会引入额外的检查并降低性能,因为编译器将分别处理跨越对齐边界的对象部分。文章强调了非对齐访问在某些平台上可能的效率损失。

1926

被折叠的 条评论
为什么被折叠?



