What's left for 1.0?
Chris Miller
chris at dprogramming.com
Fri Nov 17 23:31:21 PST 2006
On Fri, 17 Nov 2006 23:45:59 -0500, Bill Baxter
<dnewsgroup at billbaxter.com> wrote:
> Bill Baxter wrote:
> * No way to initialize a static array without counting elements
> static byte[???] imageData = [...]; // i hope you like counting!
Perhaps specifying 0 should be the convenient syntax:
static byte[0] imageData = [...]; // real length replaced
>
> * No way to initialize a dynamic array with a known length
> byte[] imageData; imageData.length = 5; // two steps - meh
auto imageData = new byte[5];
>
> * No way to initialize array of strings
> char[][] list = ["eggs","bacon","milk","break"]; //uh uh
This is a weird one but here is a workaround:
char[][] list = ["eggs"[],"bacon","milk","break"];
but since static and const array initializers can get by without this
workaround, so should initializers for other arrays.
>
> * No way to initialize non-static struct
> Point p = { x:1.0, y:2.0 }; // nope...not static
Agreed; workaround is to use a const dummy:
const Point p_init = { x:1.0, y:2.0 };
Point p = p_init;
>
> * No way to initialize associative array
> char[int] strTable = {"hello":5, "hi":2, "greetings":9}; // no way
I'd be OK if this were a 2.0 thing.
More information about the Digitalmars-d
mailing list