From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4708 invoked by alias); 23 Apr 2003 18:30:55 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 4667 invoked from network); 23 Apr 2003 18:30:52 -0000 Received: from unknown (HELO lacrosse.corp.redhat.com) (66.187.233.200) by sources.redhat.com with SMTP; 23 Apr 2003 18:30:52 -0000 Received: from prospero.boston.redhat.com (sebastian-int.corp.redhat.com [172.16.52.221]) by lacrosse.corp.redhat.com (8.11.6/8.9.3) with ESMTP id h3NIUqV23780; Wed, 23 Apr 2003 14:30:52 -0400 Received: by prospero.boston.redhat.com (Postfix, from userid 4046) id DE753F8D67; Wed, 23 Apr 2003 14:27:57 -0400 (EDT) To: tromey@redhat.com Cc: Jamie Lokier , Andrew Haley , gcc@gcc.gnu.org Subject: Re: On alignment From: Jason Merrill In-Reply-To: <87lly1f5ir.fsf@fleche.redhat.com> (Tom Tromey's message of "23 Apr 2003 12:11:24 -0600") References: <200303251122.13693.kevin.hendricks@sympatico.ca> <200303251344.59988.kevin.hendricks@sympatico.ca> <16037.6826.35777.756256@cuddles.redhat.com> <20030423124944.GA24593@mail.jlokier.co.uk> <87wuhlgq5l.fsf@fleche.redhat.com> <87lly1f5ir.fsf@fleche.redhat.com> Date: Wed, 23 Apr 2003 19:13:00 -0000 Message-ID: User-Agent: Gnus/5.090013 (Oort Gnus v0.13) Emacs/21.2 (i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-04/txt/msg01170.txt.bz2 On 23 Apr 2003 12:11:24 -0600, Tom Tromey wrote: >>>>>> "Jason" == Jason Merrill writes: > > [ about struct foo { double x; } ] > > Tom> I'd like to find the most future-proof way to do this. In the above, > Tom> is __alignof__(foo::x) the best way? I'm only concerned with > Tom> alignment of fields. > > Jason> It is since my recent patch to do all alignment calculation for > Jason> fields in layout_decl. > > I can't do this. > > struct aligner { double field; }; > > int compute () { return __alignof__ (aligner::field); } Ah, no, you need to do something like #define FIELD_ALIGNOF(TYPE) __alignof (((struct { TYPE t; } *)0)->t) Jason