------- Comment #4 from [EMAIL PROTECTED]  2008-11-19 20:07 -------
(In reply to comment #2)
> I'd disagree that scope dynamic arrays should be stack allocated.  The
> int[variableSize] syntax for that is perfectly good, if Walter wants to
> implement it.  If you're allocating a very large array, you probably don't 
> want
> to allocate it on the stack so you don't overflow the stack.

I take my words back. I believe now it is up to the compiler to decide where to
put that scope array.

> Furthermore, you can't resize stack allocated arrays after they're created, 
> at least not in C99.

Well, yes and no. You can't resize C99-like variable-length array because it is
supposed to behave like a static one. But scope T[] array may be easily resized
even if it is stack allocated and initially points to stack. It could cause
some problems if array data would be realloc'ated upon resize (you may end up
with trying to reallocate stack space), but since it doesn't and old array is
left for garage collector recycling, your data will be moved to heap after
firrst array resize while a copy of them stays on stack until you leave the

P.S. Now that I wrote the last sentence I start wondering if it really behaves
as I think :) Is the array resize policy documented anywhere?


Reply via email to