[cxx-abi-dev] What is alignof(decltype(nullptr))?

John McCall rjmccall at apple.com
Thu Apr 23 18:43:37 UTC 2015


> On Apr 23, 2015, at 11:35 AM, Richard Smith <richardsmith at google.com> wrote:
> The C++ standard requires that sizeof(nullptr) == sizeof(void*) (presumably to support programs that use sizeof(NULL) for some purpose) but does not appear to place any requirements on alignof(decltype(nullptr)). This clearly needs to be part of the ABI, and current implementations of the Itanium C++ ABI differ: Clang and EDG use alignof(void*). GCC uses 1.
> 
> We should pick a value and specify it in the ABI. alignof(void*) seems like a better answer to me. Thoughts?

I agree that alignof(void*) is the right answer, and it should probably even be standardized that way.

John.


More information about the cxx-abi-dev mailing list