August 30, 2002 VLA's Re: new C 8.30.1 beta | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In September's issue of CUJ, there is a nice article (starts page 27) by Stroustrup on VLA's... Basically, he says there is no standard way of handling memory error's when declaring a VLA and that the standard does not say that the memory should be on heap or stack as well as a whole host of other issues... As an aside there is also a discussion on the keyword export in another article, which is worth a read. In article <aj7675$317m$1@digitaldaemon.com>, Walter says... > > >"Matthew Wilson" <matthew@thedjournal.com> wrote in message news:aj6raq$2mb4$1@digitaldaemon.com... >> It's bad that there seems to be no direction from the standards as to what happens during allocation failure. Makes writing standard compliant code more difficult. I must have a read of the standard when I get a spare >minute >> (in about 3 years!) > >I agree. There are also what appear to me to be errors in the examples given - perhaps because no compiler existed to try this stuff out on before it was standardized. The silence on error handling is another mistake. I also cannot figure out the point the 'static' array index is for (I know what it does, just not the why.) > >> It's good that you're allocating from the stack. Is that itself (as >opposed >> to getting from the heap) part of the standard? I seem to recall that it should be allocated from the heap, but the memory is vague. > >I don't think the standard makes any mention of that. It's supposed to be possible to implement standard C on a stackless architecture. > > |
August 30, 2002 Re: VLA's Re: new C 8.30.1 beta | ||||
---|---|---|---|---|
| ||||
Posted in reply to damiandixon | Thanks for the pointer. I agree with his assessment on the problems with VLA's. <damiandixon@netscape.net> wrote in message news:akn8f0$2ftq$1@digitaldaemon.com... > In September's issue of CUJ, there is a nice article (starts page 27) > by Stroustrup on VLA's... > > Basically, he says there is no standard way of handling memory error's > when declaring a VLA and that the standard does not say that the > memory should be on heap or stack as well as a whole host of > other issues... > > As an aside there is also a discussion on the keyword export in another article, which is worth a read. > > In article <aj7675$317m$1@digitaldaemon.com>, Walter says... > > > > > >"Matthew Wilson" <matthew@thedjournal.com> wrote in message news:aj6raq$2mb4$1@digitaldaemon.com... > >> It's bad that there seems to be no direction from the standards as to what > >> happens during allocation failure. Makes writing standard compliant code > >> more difficult. I must have a read of the standard when I get a spare > >minute > >> (in about 3 years!) > > > >I agree. There are also what appear to me to be errors in the examples given - perhaps because no compiler existed to try this stuff out on before > >it was standardized. The silence on error handling is another mistake. I also cannot figure out the point the 'static' array index is for (I know what it does, just not the why.) > > > >> It's good that you're allocating from the stack. Is that itself (as > >opposed > >> to getting from the heap) part of the standard? I seem to recall that it > >> should be allocated from the heap, but the memory is vague. > > > >I don't think the standard makes any mention of that. It's supposed to be possible to implement standard C on a stackless architecture. > > > > > > |
Copyright © 1999-2021 by the D Language Foundation