Static arrays problem

Sean Kelly sean at invisibleduck.org
Wed Dec 17 14:06:05 PST 2008


== Quote from bearophile (bearophileHUGS at lycos.com)'s article
> At the bottom of this post there are two little test programs that may show a problem with static
arrays.

Could you describe what the problem is?

> -------------------------
> // D code, it's the same,
> // I have just changed the first 3 lines.
> import std.c.stdio: printf;
> const int N = 65;
> const int M = (N+N);
> float a[3][N][N][M];
> float b[4][N][N][M];
> float c[N][N][M];

Consider changing this to:

float a[3][N][N][M] = void;
float b[4][N][N][M] = void;
float c[N][N][M] = void;

You don't need default initialization if you're just going to
manually initialize to 0.0 anyway, so eliminate it.


Sean



More information about the Digitalmars-d mailing list