Why 16Mib static array size limit?

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 17 21:16:19 PDT 2016


On Thu, 18 Aug 2016 01:18:03 +0000, Yuxuan Shui wrote:

> On Thursday, 18 August 2016 at 00:20:32 UTC, Chris Wright wrote:
>> On Wed, 17 Aug 2016 22:12:25 +0000, Yuxuan Shui wrote:
>>> But doing so would be incorrect if D doesn't provide strong aliasing
>>> guarantees. And if D does provide these guarantees,
>>> we won't need to do this manually.
>>
>> The language can analyze all code that affects a local variable in many
>> cases. You don't always need the language to guarantee it's impossible
>> if the compiler can see that the user isn't doing anything funky.
> 
> That's right. But for Ali's code, the compiler is clearly not smart
> enough.

Most of the time, the compiler can successfully make those optimizations 
for local variables. The compiler can seldom make them for global 
variables. You get into whole program analysis territory pretty fast.

So it's not surprising that the compiler doesn't handle global variables 
as well as it does local ones.


More information about the Digitalmars-d mailing list