Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 8 May 2014 16:02:30 -0400
From: Rich Felker <dalias@...c.org>
To: Paweł Dziepak <pdziepak@...rnos.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] add definition of max_align_t to stddef.h

On Thu, May 08, 2014 at 09:45:39PM +0200, Paweł Dziepak wrote:
> 6.7.5 doesn't mention such requirement. _Alignas, obviously, cannot
> reduce the alignment requirement and the specified alignment has to
> has to be either a valid fundamental alignment or valid extended
> alignment supported by the implementation. Moreover, 6.2.8 requires
> that valid alignment is a nonnegative integral power of two. As for
> the additional requirement in contract of aligned_alloc 7.22.3.1
> states that the requested alignment has to be valid and divide size of
> the requested memory block. I don't see how that would disallow using
> in alignas alignment larger than the size of the object.

The alignment of a type must divide its size; this is fundamental to
the existence of arrays. It's possible that, for an ugly definition of
"alignment of an object" independent of an alignment associated with
the type, some objects could be aligned with more alignment than their
size, but I'm not convinced that the standard intends to allow such
nonsense. My point about aligned_alloc was that its interface
requirements reflect the notion that alignment always divides size.

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.