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