Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: multidimensional heap arrays |
| Date | 2011-04-27 10:03 +1200 |
| Message-ID | <91otpcFq9bU11@mid.individual.net> (permalink) |
| References | (4 earlier) <0.ba05a251a5fe8eed2ac7.20110426121957BST.8739l5dztu.fsf@bsb.me.uk> <91noctFq9bU7@mid.individual.net> <0.bece330a32ff7f1d21e3.20110426210623BST.87r58odbgg.fsf@bsb.me.uk> <91oq24Fq9bU9@mid.individual.net> <lny62wy9ns.fsf@nuthaus.mib.org> |
On 04/27/11 09:39 AM, Keith Thompson wrote: > Ian Collins<ian-news@hotmail.com> writes: >> On 04/27/11 08:06 AM, Ben Bacarisse wrote: >>> Ian Collins<ian-news@hotmail.com> writes: >>> >>>> On 04/26/11 11:19 PM, Ben Bacarisse wrote: >>>>> Francois Grieu<fgrieu@gmail.com> writes: >>>>> >>>>>> On 26/04/2011 06:19, Anand Hariharan wrote: >>>>> >>>>>>> or will the 'arr' in the following code be a 'plain and ordinary' >>>>>>> array ... >>>>>>> >>>>>>> const int ncol = 5; >>>>>>> int arr[ncol]; >>>>> >>>>> The former. This is a VLA and will remain so in C1x. >>>>> >>>>>> I'm genuinely wondering: is ncol a "constant expression" ? >>>>> >>>>> It might be in that an implementation can define its own forms of >>>>> constant expression, but it does not meet the standard's minimum >>>>> requirements to be an "integer constant expression" (which is what is >>>>> required to declare a non-VL array). >>>> >>>> Which is really silly. I do wish they could fix that and bring it in >>>> line with C++. But I guess adding VLAs shot that idea in the foot. >>> >>> I too would like to have seen the same constant expression definition >>> between C++ and C but I don't see how C's VLAs got in the way of that. >> >> The code above sums it up, if ncol is an "integer constant expression" >> is arr an array, or a VLA? >> >> Would it be acceptable for a language change to change (all be it >> subtly) the behaviour of existing code? > > What behavior would change? > > Currently, arr is a VLA. If the rules were changed to make ncol a > constant expression, as it is in C++, arr would be an ordinary array > object, not a VLA. As far as I can tell, this would merely make some > things legal and well-defined that are currently either constraint > violations or undefined behavior. I can't think of any cases were valid > code would either become invalid or change its (currently defined) > behavior. Can you? No I can't off hand, but I'm sure someone could (Ben?). To be honest, I was struggling to find a reason why this obvious change hadn't been made and VLAs were the only (if feeble) one I could find... -- Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
multidimensional heap arrays Jack Boot <jackboot@mailinator.com> - 2011-04-25 19:36 +0000
Re: multidimensional heap arrays Francois Grieu <fgrieu@gmail.com> - 2011-04-25 23:16 +0200
Re: multidimensional heap arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-25 22:35 +0100
Re: multidimensional heap arrays Anand Hariharan <mailto.anand.hariharan@gmail.com> - 2011-04-25 21:19 -0700
Re: multidimensional heap arrays Francois Grieu <fgrieu@gmail.com> - 2011-04-26 08:19 +0200
Re: multidimensional heap arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-26 12:19 +0100
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-26 23:25 +1200
Re: multidimensional heap arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-26 21:06 +0100
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-27 08:59 +1200
Re: multidimensional heap arrays Keith Thompson <kst-u@mib.org> - 2011-04-26 14:39 -0700
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-27 10:03 +1200
Re: multidimensional heap arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-26 23:41 +0100
Re: multidimensional heap arrays Keith Thompson <kst-u@mib.org> - 2011-04-26 16:33 -0700
Re: multidimensional heap arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-27 04:05 +0100
Re: multidimensional heap arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-26 22:49 +0100
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-27 10:19 +1200
Re: multidimensional heap arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-27 00:38 +0100
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-27 11:48 +1200
Re: multidimensional heap arrays Keith Thompson <kst-u@mib.org> - 2011-04-26 17:38 -0700
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-27 13:08 +1200
Re: multidimensional heap arrays Tim Rentsch <txr@alumni.caltech.edu> - 2011-04-26 18:31 -0700
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-27 14:01 +1200
Re: multidimensional heap arrays Tim Rentsch <txr@alumni.caltech.edu> - 2011-04-27 00:04 -0700
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-27 19:58 +1200
Re: multidimensional heap arrays Ian Collins <ian-news@hotmail.com> - 2011-04-27 20:03 +1200
Re: multidimensional heap arrays Keith Thompson <kst-u@mib.org> - 2011-04-27 00:03 -0700
Re: multidimensional heap arrays Tim Rentsch <txr@alumni.caltech.edu> - 2011-04-26 18:20 -0700
Re: multidimensional heap arrays Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-04-27 03:59 +0100
Re: multidimensional heap arrays Tim Rentsch <txr@alumni.caltech.edu> - 2011-04-27 00:24 -0700
Re: multidimensional heap arrays "io_x" <a@b.c.invalid> - 2011-04-26 09:42 +0200
Re: multidimensional heap arrays Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-25 20:50 -0400
Re: multidimensional heap arrays James Kuyper <jameskuyper@verizon.net> - 2011-04-25 22:57 -0400
csiph-web