arrays && functions && pointers

MM MM_member at pathlink.com
Mon Jun 19 16:14:01 PDT 2006


I did a new test:

import std.c.stdlib;
import std.stdio;
import std.perf;

const int TILEW = 1000;
const int TILEH = 1000;

struct TILE { int x,y; int z[1]; }

void foo(TILE arr[TILEW][TILEH], int i) {
arr[i%TILEW][i%TILEH].x=i;
}

void main()
{
PerformanceCounter c = new PerformanceCounter();
int i;


TILE[TILEH][TILEW] arr2;
c.start();
for(i = 0; i < 10000000; i++) foo(arr2,i);
c.stop();
writefln("foo took: ",c.milliseconds());

}

It runs without a problem... I really don't know why and how, because just
yesterday it didn't :/
Is this maybe because some other program was using the same stack?  
If this is true, how do I check how much is left on the stack? 
I'm really not into this, I'm sorry.

The maximum size of an static array should be 16MB.
At least it says so here :)
http://www.digitalmars.com/d/arrays.html

Btw, is a stacked array a bad thing?





More information about the Digitalmars-d-learn mailing list