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

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.

> 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.

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.