From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27615 invoked by alias); 8 Oct 2002 16:12:52 -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 27604 invoked from network); 8 Oct 2002 16:12:48 -0000 Received: from unknown (HELO mx2.redhat.com) (12.150.115.133) by sources.redhat.com with SMTP; 8 Oct 2002 16:12:48 -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 g98GCPs27054; Tue, 8 Oct 2002 12:12:25 -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 g98GCll30475; Tue, 8 Oct 2002 12:12:48 -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 g98GCkw13966; Tue, 8 Oct 2002 09:12:46 -0700 Received: (from wilson@localhost) by tonopah.toronto.redhat.com (8.11.6/8.11.6) id g98GCjp30751; Tue, 8 Oct 2002 12:12:45 -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 11:09:00 -0000 In-Reply-To: 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/msg00478.txt.bz2 >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. I was a little too hasty here. ISO C99 has VLAs, and VLAs are obviously variable sized types. What I meant to say was that ISO C99 can never have an argument with a variable sized type. Arrays decay to pointers when used as arguments, and VLAs aren't allowed inside structures, so there is no way to get a variable sized argument in ISO C99. There isn't any other place in C where variable sized types are a problem. There are other places in C++, but the VLA rules may be enough to avoid all problems. GNU C dynamic arrays can be used to create variable sized arguments. The Ada language can also have variable sized arguments, and the GNU C dynamic arrays feature can be useful for testing support needed for Ada. Jim