From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5102 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Pawe=C5=82_Dziepak?= Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] add definition of max_align_t to stddef.h Date: Thu, 8 May 2014 22:45:20 +0200 Message-ID: References: <20140507031306.GA26963@brightrain.aerifal.cx> <20140507230729.GD26358@brightrain.aerifal.cx> <20140508174138.GJ26358@brightrain.aerifal.cx> <20140508200230.GK26358@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: quoted-printable X-Trace: ger.gmane.org 1399581942 4435 80.91.229.3 (8 May 2014 20:45:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2014 20:45:42 +0000 (UTC) Cc: musl@lists.openwall.com To: Rich Felker Original-X-From: musl-return-5107-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 08 22:45:36 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 1WiVCA-0002ZZ-48 for gllmg-musl@plane.gmane.org; Thu, 08 May 2014 22:45:34 +0200 Original-Received: (qmail 32733 invoked by uid 550); 8 May 2014 20:45:33 -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 32722 invoked from network); 8 May 2014 20:45:32 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=lXRlOSG4deudnpUX1mJYxe8quldDvtgfOKPtbtcP+7k=; b=m0CWYlLaEzc6Xo0eSj01qQon5UkxeJ9ckFKLCeQYWF4cl7qVRDXeVtaSu1v8cnZfH5 PkpREKOK1t2dJR9uLr7WZN8Y+PlpWWUV3KBYk6PyD0TbZbk3O6Igg5y7vRSgPMtldVUN 8X4sU+MLgMHtMJXCzstrwY66zCoC98FAzfSHVxh4u5+R/uaeor9LsdqaUdYDJf+C+JRS hV/7KRqpCIABzoqbHgNG1t1CUuREr0AqOiSjgPrh2964/O+Qt69IcDHeXsKv80b3qRSU NJ+JiGDnIVW9pupNzKPm/JofuKQVTaOlskVGFNarfWHDOT64IyBoWitSukEJ2uIj7QAO FcOQ== X-Gm-Message-State: ALoCoQk/lSe0VDOZ+f7iYVDIQputH//xpO3ZHG+Kc0Z8d/Uvbbs5CuGDTiemJRi/ipU1Zth/8oAs X-Received: by 10.50.131.130 with SMTP id om2mr59595977igb.25.1399581920908; Thu, 08 May 2014 13:45:20 -0700 (PDT) In-Reply-To: <20140508200230.GK26358@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:5102 Archived-At: 2014-05-08 22:02 GMT+02:00 Rich Felker : > On Thu, May 08, 2014 at 09:45:39PM +0200, Pawe=C5=82 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. I'm not sure how alignas() could cause problems with arrays. It cannot be used in declarations of typedefs. When applied to structure member or the whole structure (like struct alignas(N) foo { ... }, C++11 alows it) it changes the size of the structure itself so the alignment remains less than or equal size of the object and in declarations like this: alignas(N) T foo[K]; alignas() applies to the array foo, not each individual element of that arr= ay. Pawe=C5=82