Re: Why do static arrays affect executable size?

2017-02-11 Thread Bastiaan Veelo via Digitalmars-d-learn
Thanks for the clarifications.

Re: Why do static arrays affect executable size?

2017-02-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Saturday, 11 February 2017 at 00:16:04 UTC, sarn wrote: If you explicitly initialise the array to all 0.0, you should see it disappear from the binary. I was actually wondering whether initialisation would make a difference, so thank you for this. Bastiaan.

Re: Why do static arrays affect executable size?

2017-02-10 Thread sarn via Digitalmars-d-learn
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

Re: Why do static arrays affect executable size?

2017-02-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, February 10, 2017 11:21:48 Bastiaan Veelo via Digitalmars-d-learn wrote: > // enum int maxarray = 0; > enum int maxarray = 2_000_000; > > double[maxarray] a, b, c, d; > > void main() {} > > > Compiled using "dub build --arch=x86_64 --build=release" on > Windows (DMD32 D Compiler

Re: Why do static arrays affect executable size?

2017-02-10 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 10 February 2017 at 11:21:48 UTC, Bastiaan Veelo wrote: // enum int maxarray = 0; enum int maxarray = 2_000_000; double[maxarray] a, b, c, d; void main() {} Compiled using "dub build --arch=x86_64 --build=release" on Windows (DMD32 D Compiler v2.073.0), the exe size is 302_592

Why do static arrays affect executable size?

2017-02-10 Thread Bastiaan Veelo via Digitalmars-d-learn
// enum int maxarray = 0; enum int maxarray = 2_000_000; double[maxarray] a, b, c, d; void main() {} Compiled using "dub build --arch=x86_64 --build=release" on Windows (DMD32 D Compiler v2.073.0), the exe size is 302_592 bytes v.s. 64_302_592 bytes, depending on the array length. Is that