D - D dynamic array initialization
- Dan Liebgold (16/16) Mar 10 2003 D should allow dynamic arrays to be initialized like static arrays, and ...
- Walter (5/21) Mar 13 2003 Yes, those are good ideas.
D should allow dynamic arrays to be initialized like static arrays, and with dynamic initializers as well. For example: void test (float max) { float table[] = [ max*0.25, max*0.5, max*0.75, max ]; } And also for associative arrays: void test2 () { int maptable[char[]] = [ "hello":0, "world":1, "\n":2 ]; } Perhaps the expression "[1,2,3]" could create a dynamic array in place, and assignment would copy it. This would enable expressions like: void func (char [] name, float[] table) { ... } void test3 () { func("stuff", [1.2, 2.4, 4.8]); } Dan
Mar 10 2003
Yes, those are good ideas. "Dan Liebgold" <dliebgold yahoo.com> wrote in message news:b4k3bm$h9j$1 digitaldaemon.com...D should allow dynamic arrays to be initialized like static arrays, andwithdynamic initializers as well. For example: void test (float max) { float table[] = [ max*0.25, max*0.5, max*0.75, max ]; } And also for associative arrays: void test2 () { int maptable[char[]] = [ "hello":0, "world":1, "\n":2 ]; } Perhaps the expression "[1,2,3]" could create a dynamic array in place,andassignment would copy it. This would enable expressions like: void func (char [] name, float[] table) { ... } void test3 () { func("stuff", [1.2, 2.4, 4.8]); } Dan
Mar 13 2003