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

Vladimir Panteleev thecybershadow at gmail.com
Tue Oct 2 12:24:44 PDT 2007


On Tue, 02 Oct 2007 21:48:34 +0300, Walter Bright <newshound1 at digitalmars.com> wrote:

> Vladimir Panteleev wrote:
>> Thanks, however dynamic arrays are unfortunately slow. To access a
>> random element, you need a dereference, a multiplication+addition,
>> another dereference, another multiplication+addition. Janice Caron's
>> workaround, when modified to use a struct placed in the data segment,
>> requires only one dereferencing/multiply+adding - while a static
>> array placed in the data segment requires only arithmetics to access.
>
> If you define an array as:
>
> int[10000][] a = new int[10000][100];
>
> only one dereference is required to access the data.

Yes, only one - when there should be none at all. *sigh*

Note that one thing which the compiler fails to prevent but still chokes the linker are having more than 16 Mb of data or even distinct types (which need initial values, such as structs/classes). Example:

uint[0x800000] a,b,c,d;

void main()
{
}

So - please, Just Fix That Linker ;)

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



More information about the Digitalmars-d mailing list