微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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之前找到任意填充,但是如果这种情况是这样的,那么答案是没有任何对齐保证;我选择将此解释为次要措辞缺陷.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐