On Friday, 10 February 2017 at 15:12:28 UTC, Jonathan M Davis
wrote:
Module-level and static variables all get put in the
executable. So, declaring a static array like that is going to
take up space. A dynamic array would do the same thing if you
gave it a value of that size. The same thing happens with
global and static variables in C/C++.
An important difference with C/C++ in this case is that D floats
are initialised to NaN, not 0.0. In binary (assuming IEEE
floating point), 0.0 has an all-zero representation, but NaNs
don't. Therefore, in C/C++ (on most platforms),
default-initialised floats can be allocated in the BSS segment,
which doesn't take up executable space, but in D,
default-initialised floats have to be put into the compiled
binary.
If you explicitly initialise the array to all 0.0, you should see
it disappear from the binary.