"The total size of a static array cannot exceed 16Mb."

Vladimir Panteleev thecybershadow at gmail.com
Mon Oct 1 23:20:29 PDT 2007


Why?

I posted a bug report yesterday, thinking it was just some accidentally left over code.
But I noticed this statement in the documentation today. And, frankly, I don't understand why that limitation is there.

The problem with this restriction comes when using multi-dimensional arrays. Branched dynamic arrays are MUCH slower than rectangular/cubic/etc. static arrays - and this is a severe limitation for anyone wanting to work with large amounts of data (e.g. game maps). Of course I could work around this by calculating the positions manually using x*width+y, but I'd like to know the reason why this limitation was put there in the first place, and what's the reasoning behind it. No other compiled language that I used (C/C++/Delphi) has such a limitation.

The check is in mtype.c, line 1835 (DMD 1.021).

-- 
Best regards,
 Vladimir                          mailto:thecybershadow at gmail.com



More information about the Digitalmars-d mailing list