Static arrays problem

bearophile bearophileHUGS at lycos.com
Wed Dec 17 14:13:45 PST 2008


Sean Kelly:
> Could you describe what the problem is?

The problem is that the D code produces an huge executable.


> 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.

Thank you, that fixes the problem, the exe size is now a more normal 180.252 bytes :-)

I think the D compiler has to take a look at the size of the static arrays, if they are too much large, then their initialization has to be done with a loop, avoiding the creation of such huge executables.

Bye,
bearophile



More information about the Digitalmars-d mailing list