miscellaneous array questions...

WhatMeWorry kheaser at gmail.com
Mon Jul 20 22:05:35 UTC 2020


1) The D Language Reference says:

"There are four kinds of arrays..." with the first example being
"type*	Pointers to data"  and "int* p;  etc.

At the risk of sounding overly nitpicky, isn't a pointer to an 
integer simply a pointer to an integer?  How does that pertain to 
an array?


2) "The total size of a static array cannot exceed 16Mb" What 
limits this? And with modern systems of 16GB and 32GB, isn't 16Mb 
excessively small?   (an aside: shouldn't that be 16MB in the 
reference instead of 16Mb? that is, Doesn't b = bits and B = 
bytes)


3) Lastly, In the following code snippet, is arrayA and arrayB 
both allocated on the stack? And how does their scopes and/or 
lifetimes differ?

==== module1 =====
int[100] arrayA;
void main()
{
     int[100] arrayB;
     // ...
}
==== module1 =====



More information about the Digitalmars-d-learn mailing list