From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3775 invoked by alias); 24 Sep 2004 08:36:22 -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 3708 invoked from network); 24 Sep 2004 08:36:18 -0000 Received: from unknown (HELO lon-mail-1.gradwell.net) (193.111.201.125) by sourceware.org with SMTP; 24 Sep 2004 08:36:18 -0000 Received: (qmail 54433 invoked from network); 24 Sep 2004 08:36:18 -0000 Received: from digraph.polyomino.org.uk (postmaster%pop3.polyomino.org.uk@81.187.227.50) by lon-mail-1.gradwell.net with SMTP; 24 Sep 2004 08:36:18 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.41) id 1CAlYv-0006yj-HW; Fri, 24 Sep 2004 08:36:17 +0000 Date: Fri, 24 Sep 2004 09:17:00 -0000 From: "Joseph S. Myers" X-X-Sender: jsm28@digraph.polyomino.org.uk To: Giovanni Bajo cc: Gabriel Dos Reis , gcc@gcc.gnu.org Subject: Re: attribute data structure rewrite In-Reply-To: <006d01c4a1dd$ffc60b70$dc4e2a97@bagio> Message-ID: References: <006d01c4a1dd$ffc60b70$dc4e2a97@bagio> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2004-09/txt/msg01414.txt.bz2 On Fri, 24 Sep 2004, Giovanni Bajo wrote: > 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? Compile-time undefined for both C and C++, no diagnostic required; one couldn't reasonably be given with the old macro implementations. Either diagnose the use of non-integer-constant-expressions in offsetof, or permit them but make them cause the result not to be an integer constant expression. -- Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/ http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0 jsm@polyomino.org.uk (personal mail) jsm28@gcc.gnu.org (Bugzilla assignments and CCs)