gpt4 book ai didi

c++ - 通过 Itanium ABI 分配的异常内存是否有任何对齐保证?

转载 作者:可可西里 更新时间:2023-11-01 18:35:44 39 4
gpt4 key购买 nike

Itanium ABI 指出异常的内存是通过调用 __cxa_allocate_exception(size) 获得的。返回内存的对齐保证是什么?

最佳答案

Section 1.2 in chapter 4说:

The unwind interface uses a pointer to an exception header object as its representation of an exception being thrown. In general, the full representation of an exception object is language- and implementation-specific, but it will be prefixed by a header understood by the unwind interface, defined as follows:

后面是struct _Unwind_Exception 的定义,后面是:

An _Unwind_Exception object must be double-word aligned.

由于这是整个异常对象的前缀,因此整个内存块必须双字对齐。

可以说,此文本不禁止在_Unwind_Exception 之前找到任意填充,但如果情况确实如此,那么答案就是没有任何对齐保证;我选择将此解释为一个小的措辞缺陷。

关于c++ - 通过 Itanium ABI 分配的异常内存是否有任何对齐保证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24119741/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com