Void initialization

Bear joanyleprince at yahoo.fr
Mon Dec 19 04:04:20 PST 2011

Using D1, I have a program that creates tons of float[] ; for performance
reasons, I would like them to be uninitialized.
I've tried replacing

float[] f = new float[x];
float[] f = cast(float[])std.gc.malloc(x*4);

Unfortunately I keep running into "Access violation" and sometimes "Array
bounds error". I've tried adding

setTypeInfo(typeid(float), f.ptr);
and hasNoPointer(f.ptr);

which didn't work.

f[] = float.nan;
solved the problem, but kinda defeats the purpose of using malloc...
What am I doing wrong?

More information about the Digitalmars-d-learn mailing list