Why 16Mib static array size limit?

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 18 11:54:08 PDT 2016


On 08/18/2016 05:20 AM, Johan Engelen wrote:

 > `arr` is a global symbol that can be modified by code
 > not seen by the compiler. So no assumptions can be made about the
 > contents of arr.ptr and arr.length

Yet there is the following text in the spec:

* https://dlang.org/spec/statement.html#ForeachStatement

   "The aggregate must be loop invariant, meaning that elements to
    the aggregate cannot be added or removed from it in the
    NoScopeNonEmptyStatement."

I think the spirit of the spec includes other code outside of 
NoScopeNonEmptyStatement as well. If so, if elements are added to the 
array from other code (e.g. other threads) it should be a case of "all 
bets are off". So, I think both .ptr and .length could be cached.

Ali



More information about the Digitalmars-d mailing list