Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.std.c Subject: Re: Why are VLAs optional in C11? Date: Sun, 19 Aug 2012 13:59:42 -0700 Organization: None to speak of Lines: 38 Message-ID: References: <502ED178.50603@loria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="5842a546a2d4559ed11e9ac4721da702"; logging-data="25203"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tXicKjQkXRfNBlHfaEX+0" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:wKbCvbVxQHbAEVJP1XvTyS8jlkQ= sha1:nUsnz3SsK/nVqKcfXwO8VxQHsEE= Xref: csiph.com comp.std.c:1549 Keith Thompson writes: > John Nagle writes: > [...] >> The problem is the semantics of fixed-size array parameters >> (but not local fixed-size arrays). For those, too, the size of the >> array is just the size of a pointer. VLA parameters just repeat >> that mess from fixed-size arrays. > > No, the problem with fixed-size array parameters is that *there is no > such thing*. It's not true that "the size of the array is just the size > of the pointer". The size of the pointer is the size of the pointer. > > void func(double arr[100]); > > is nothing more than syntactic sugar (or perhaps syntactic vinegar) > for this: > > void func(double *arr); [...] John, perhaps you're approaching this from the wrong direction. You seem to be starting with the idea that `void func(double arr[100])` defines `arr` as a parameter of array type (but incidentally, C treats it as a parameter of pointer type). Instead, I suggest starting with the idea that C does not have parameters of pointer type (but incidentally, it permits pointer parameters to be defined with array syntax). That might make it easier to propose a consistent mechanism for adding array or array-like parameters to the language. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"