|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D - Feature request: array stuff
I would like to be able to allocate a dynamic array on the stack.
The following compiles, but does not achieve the desired effect:
int n = 100;
scope array = new int[n];
The array is allocated on the heap, not the stack. I would like it to
be allocated on the stack.
I would also like to be able to create uninitialised dynamic arrays:
// on the heap
auto array = new int[n] = void;
// on the stack
scope array = new int[n] = void;
Note that the last one of these can be implemented in machine code
merely by decrementing the stack pointer! (Well - almost. array.ptr
and array.length would still need to be assigned, but I can live with
that).
Obviously, increasing the length of a scope array would have to be illegal!
Finally, I want to be able to increase the length of an array without
initialising the new elements:
array.length = 100 = void;
(The syntax of the last one leaves a bit to be desired, but I can't
think of anything better off hand, right now).
Does anyone know if any or all of these are already the subject of
enhancement request? Does anyone else want any of these? Is there any
reason why I shouldn't add this to bugzilla?
Apr 24 2008
Janice Caron Wrote:I would like to be able to allocate a dynamic array on the stack. I would also like to be able to create uninitialised dynamic arrays: Apr 24 2008
Janice Caron wrote: May 04 2008
On 2008-05-08 16:18:04 +0200, "Janice Caron" <caron800 googlemail.com> said:2008/5/8 Koroskin Denis <2korden gmail.com>: May 08 2008
On Sun, 04 May 2008 19:22:29 +0400, Lionello Lunesu <lio lunesu.remove.com> wrote:Janice Caron wrote: May 08 2008
2008/5/8 Koroskin Denis <2korden gmail.com>: May 08 2008
|