From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14269 invoked by alias); 8 Oct 2002 15:53:15 -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 14259 invoked from network); 8 Oct 2002 15:53:12 -0000 Received: from unknown (HELO mx2.redhat.com) (12.150.115.133) by sources.redhat.com with SMTP; 8 Oct 2002 15:53:12 -0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.11.6/8.11.6) with ESMTP id g98Fqns26653; Tue, 8 Oct 2002 11:52:49 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g98FrBl30280; Tue, 8 Oct 2002 11:53:11 -0400 Received: from tonopah.toronto.redhat.com (tonopah.toronto.redhat.com [172.16.14.91]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g98Fr4w13296; Tue, 8 Oct 2002 08:53:04 -0700 Received: (from wilson@localhost) by tonopah.toronto.redhat.com (8.11.6/8.11.6) id g98Fr3i30726; Tue, 8 Oct 2002 11:53:03 -0400 X-Authentication-Warning: tonopah.toronto.redhat.com: wilson set sender to wilson@redhat.com using -f To: Mark Mitchell Cc: gcc@gcc.gnu.org, nathan@codesourcery.com, jason@redhat.com, gdr@codesourcery.com Subject: Re: Variable-sized types vs. templates References: <1300000.1033752147@localhost> From: Jim Wilson Date: Tue, 08 Oct 2002 10:31:00 -0000 In-Reply-To: <1300000.1033752147@localhost> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-10/txt/msg00475.txt.bz2 You are confusing ISO C99 variable length arrays (VLA) with GNU C dynamic arrays. These are related but distincly different features. GNU C dynamic arrays predate ISO C99 VLAs by almost 10 years, and it is the dynamic array support in the C++ front end that is causing problems. A key difference between the two is that GNU C dynamic arrays can exist inside a structure, and VLAs can not. This means GNU C has variable sized types, but ISO C99 does not. Variable sized types complicates things like argument passing, so it is understandable that ISO C99 left this out. I can also see that it complicates stuff like template instantiation, so it would make sense to leave this out of the C++ language also. Since dynamic arrays have been around for so long, and are used in so many programs, the C front end needs to continue supporting dynamic arrays in addition to VLAs. There seems to be some confusion here though. I just tried writing a simple testcase using a dynamic array that wasn't a valid VLA and gcc accepted it with -std=c99 -pedantic. I'm sure this will eventually be sorted out. Meanwhile, there probably isn't a lot of need to have dynamic array support in the C++ front end. You should support VLAs if at all possible, but you don't really need dynamic arrays support. There may be old programs that rely on dynamic arrays, so you probably should phase this stuff out slowly. If a dynamic array is used in a context where it can't possibly work, then give an error. if a dynamic array is used in a context where it can work, then you should continue to support it, but it would be OK to give an "obsolete feature" warning, and then delete the feature in a future release. Actually, I just noticed that someone changed the documentation in the extend.texi file to use the term VLA instead of dynamic array. I think that was a mistake, since VLA and dynamic array are not the same thing. Also, note that Ada has variable sized types, so the GNU C dynamic array feature has some use for testing features needed for Ada language support. Jim