16MB static arrays again...

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 24 11:06:06 PDT 2016


On 8/24/2016 3:35 AM, Lodovico Giaretta wrote:
> On Wednesday, 24 August 2016 at 09:38:43 UTC, Walter Bright wrote:
>> I don't know why pointers cannot be used.
>
> In my code I have a line like this:
>
> static immutable MyStruct[] data = [ MyTemplate!MyArgs ];
>
> This would not work if `MyStruct.sizeof * MyTemplate!MyArgs.length` is bigger
> than 16MB, right? And for this case there's no workaround, I think...

The compiler will run out of memory long before you've got 16 million array 
initializers.



More information about the Digitalmars-d mailing list