From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29066 invoked by alias); 24 Sep 2004 08:27:42 -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 29054 invoked from network); 24 Sep 2004 08:27:41 -0000 Received: from unknown (HELO Cantor.suse.de) (195.135.220.2) by sourceware.org with SMTP; 24 Sep 2004 08:27:41 -0000 Received: from hermes.suse.de (hermes-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id 15576C61C8C; Fri, 24 Sep 2004 10:27:41 +0200 (CEST) To: "Giovanni Bajo" Cc: Subject: Re: attribute data structure rewrite References: <006d01c4a1dd$ffc60b70$dc4e2a97@bagio> From: Andreas Schwab X-Yow: I want EARS! I want two ROUND BLACK EARS to make me feel warm 'n secure!! Date: Fri, 24 Sep 2004 08:40:00 -0000 In-Reply-To: (Andreas Schwab's message of "Fri, 24 Sep 2004 10:25:34 +0200") Message-ID: User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2004-09/txt/msg01412.txt.bz2 Andreas Schwab writes: > "Giovanni Bajo" writes: > >> Anothing thing I have been shown today is that we currently reject this: >> >> ---------------------------------------- >> #include >> #include >> >> struct A { char foo[10]; }; >> >> void bar(void) { >> int i; >> for (i=0;i<10;i++) >> printf("%d\n", offsetof(struct A, foo[i])); >> } >> -------------------------------------- >> >> but we used to accept it. Any idea about its legality? Workarounds? > > offsetof (struct A, foo[0]) + i * sizeof (foo[0]) Of course, that doesn't compile either, but you get the idea. :-) Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."