Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 27 Apr 2014 22:51:34 -0700
From: Khem Raj <raj.khem@...il.com>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH 3/3] stddef: Define max_align_t

On Sun, Apr 27, 2014 at 7:03 PM, Rich Felker <dalias@...c.org> wrote:
> On Sun, Apr 27, 2014 at 06:43:54PM -0700, Khem Raj wrote:
>> c++11 defines is and libstdc++ from gcc 4.9 now needs it
>
> Is it also in C11 or just C++11? If it's not in C11 it needs to be
> namespace protected.

yes its for both so may  something like

#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L

>
>> Signed-off-by: Khem Raj <raj.khem@...il.com>
>>
>> Upstream-Status: Pending
>> ---
>>  include/stddef.h |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/include/stddef.h b/include/stddef.h
>> index 0a32919..788227a 100644
>> --- a/include/stddef.h
>> +++ b/include/stddef.h
>> @@ -19,4 +19,9 @@
>>  #define offsetof(type, member) ((size_t)( (char *)&(((type *)0)->member) - (char *)0 ))
>>  #endif
>>
>> +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 far as I can tell, there's no reason to use the attribute here.
> What's it there for? Also a union would probably be nicer than a
> struct, but perhaps it doesn't matter.

union does not return correct alignment where as struct did. I just
tried to match
what clang also has

http://reviews.llvm.org/rL201729


>
> Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.