From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5101 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] add definition of max_align_t to stddef.h Date: Thu, 8 May 2014 16:02:30 -0400 Message-ID: <20140508200230.GK26358@brightrain.aerifal.cx> References: <20140507031306.GA26963@brightrain.aerifal.cx> <20140507230729.GD26358@brightrain.aerifal.cx> <20140508174138.GJ26358@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1399579372 31466 80.91.229.3 (8 May 2014 20:02:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2014 20:02:52 +0000 (UTC) Cc: musl@lists.openwall.com To: =?utf-8?B?UGF3ZcWC?= Dziepak Original-X-From: musl-return-5106-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 08 22:02:45 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WiUWj-00057C-C1 for gllmg-musl@plane.gmane.org; Thu, 08 May 2014 22:02:45 +0200 Original-Received: (qmail 9351 invoked by uid 550); 8 May 2014 20:02:43 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9343 invoked from network); 8 May 2014 20:02:43 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:5101 Archived-At: 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