[PATCH] Define max_align_t in C++11 and C11 mode

David Majnemer david.majnemer at gmail.com
Sun Oct 20 17:55:36 PDT 2013


[CC'ing Howard seeing as how he probably implemented the libc++ max_align_t]

Howard, what do you have thoughts on this?

My reading of 3.11 [basic.align]/p2's 'all contexts' makes me believe that
max_align_t should reflect the alignment of 'long double' inside of a
struct.


On Fri, Oct 18, 2013 at 10:10 PM, Hristo Venev <mustrumr97 at gmail.com> wrote:

> libc++ defines max_align_t as long double. I thought they had the same
> alignment.
>
>
> On Fri, Oct 18, 2013 at 8:22 PM, David Majnemer <david.majnemer at gmail.com>wrote:
>
>> This implementation of max_align_t disagrees with gcc. They have
>> something like:
>> typedef struct {
>>   long long __max_align_ll __attribute__((__aligned__(__alignof__(long
>> long))));
>>   long double __max_align_ld __attribute__((__aligned__(__alignof__(long
>> double))));
>> } max_align_t;
>>
>> as their definition while you have something like:
>>
>> typedef long double max_align_t;
>>
>> For a 32-bit x86 target, this means that:
>> gcc's alignof(max_align_t): 8
>> clang's alignof(max_align_t): 4
>>
>> --
>> David Majnemer
>>
>>
>> On Fri, Oct 18, 2013 at 9:58 AM, Hristo Venev <mustrumr97 at gmail.com>wrote:
>>
>>> Add a definition of max_align_t in stddef.h
>>> Done by gcc 4.9 and required by libstdc++ 4.9.
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131020/ac64fb14/attachment.html>


More information about the cfe-commits mailing list