www.digitalmars.com         C & C++   DMDScript  

c++.announce - new C 8.30.1 beta

reply "Walter" <walter digitalmars.com> writes:
with VLA's.

www.digitalmars.com/dmc/dmcppDownload.html
Aug 08 2002
next sibling parent reply Jan Knepper <jan smartsoft.cc> writes:
Hey I thought you were back to D! <g>



Walter wrote:

 with VLA's.

 www.digitalmars.com/dmc/dmcppDownload.html
Aug 08 2002
parent reply "Walter" <walter digitalmars.com> writes:
C99 VLAs fit in with the discussion on arrays in D, so I thought I'd gain
some experience with them for comparison. Besides, they didn't look too hard
to do <g>.

"Jan Knepper" <jan smartsoft.cc> wrote in message
news:3D53168B.2B22E091 smartsoft.cc...
 Hey I thought you were back to D! <g>



 Walter wrote:

 with VLA's.

 www.digitalmars.com/dmc/dmcppDownload.html
Aug 08 2002
parent Jan Knepper <jan smartsoft.cc> writes:
Walter wrote:

 C99 VLAs fit in with the discussion on arrays in D, so I thought I'd gain
 some experience with them for comparison. Besides, they didn't look too hard
 to do <g>.
Well, we're delighted to have it! Jan
Aug 08 2002
prev sibling parent reply "Matthew Wilson" <matthew thedjournal.com> writes:
What happens if the requested size exceeds the heap capacity?

"Walter" <walter digitalmars.com> wrote in message
news:aiv2nm$47b$1 digitaldaemon.com...
 with VLA's.

 www.digitalmars.com/dmc/dmcppDownload.html
Aug 09 2002
parent reply "Walter" <walter digitalmars.com> writes:
You should get a 'Stack Overflow' message. Note that although VLAs are
implemented for the 16 bit memory models, they are rather useless because of
the extremely limited stack space.

"Matthew Wilson" <matthew thedjournal.com> wrote in message
news:aivpt4$t4j$1 digitaldaemon.com...
 What happens if the requested size exceeds the heap capacity?

 "Walter" <walter digitalmars.com> wrote in message
 news:aiv2nm$47b$1 digitaldaemon.com...
 with VLA's.

 www.digitalmars.com/dmc/dmcppDownload.html
Aug 09 2002
parent reply "Matthew Wilson" <matthew thedjournal.com> writes:
So the Stack Overflow is part of the standard?

Also, do you allocate the memory from the stack (a la alloca()), or from the
heap?

"Walter" <walter digitalmars.com> wrote in message
news:aivq28$tpt$1 digitaldaemon.com...
 You should get a 'Stack Overflow' message. Note that although VLAs are
 implemented for the 16 bit memory models, they are rather useless because
of
 the extremely limited stack space.

 "Matthew Wilson" <matthew thedjournal.com> wrote in message
 news:aivpt4$t4j$1 digitaldaemon.com...
 What happens if the requested size exceeds the heap capacity?

 "Walter" <walter digitalmars.com> wrote in message
 news:aiv2nm$47b$1 digitaldaemon.com...
 with VLA's.

 www.digitalmars.com/dmc/dmcppDownload.html
Aug 09 2002
parent reply "Walter" <walter digitalmars.com> writes:
"Matthew Wilson" <matthew thedjournal.com> wrote in message
news:aivr4k$12hn$1 digitaldaemon.com...
 So the Stack Overflow is part of the standard?
I couldn't find anything in the standard about what happens if the allocation fails.
 Also, do you allocate the memory from the stack (a la alloca()), or from
the
 heap?
It generates a call to alloca().
Aug 09 2002
parent reply "Matthew Wilson" <matthew thedjournal.com> writes:
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!)

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.

"Walter" <walter digitalmars.com> wrote in message
news:aj0ri7$2erk$1 digitaldaemon.com...
 "Matthew Wilson" <matthew thedjournal.com> wrote in message
 news:aivr4k$12hn$1 digitaldaemon.com...
 So the Stack Overflow is part of the standard?
I couldn't find anything in the standard about what happens if the allocation fails.
 Also, do you allocate the memory from the stack (a la alloca()), or from
the
 heap?
It generates a call to alloca().
Aug 11 2002
parent reply "Walter" <walter digitalmars.com> writes:
"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.
Aug 11 2002
parent reply damiandixon netscape.net writes:
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.
Aug 30 2002
parent "Walter" <walter digitalmars.com> writes:
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.
Aug 30 2002