If you compile a program like this:
double[100_000] arr;
void main() {}
With dmd you produce a binary about 1 MB in size, because doubles in D are not
filled with zero.
So for n-D arrays bigger than a certain amount of memory, can DMD compile that
code with a zero initialization plus filling of the Nans at run-time?
Note: this produces the same very large binary, I don't know why:
double[100_000] arr = void;
static this() {
arr[] = typeof(arr[0]).init;
}
void main() {}
While this hangs my compiler, I don't know why:
double[100_000] arr = 0.0;
static this() {
arr[] = typeof(arr[0]).init;
}
void main() {}
Bye,
bearophile