Finally full multidimensional arrays support in D

Stefan Frijters via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 10 12:04:17 PDT 2014


I've been using the multidimensional arrays for a while now, but 
recently I've run into a problem w.r.t. optimization:

import std.stdio;
import unstd.multidimarray;

void main() {
   MultidimArray!(double, 3) arr;
   arr = multidimArray!double([1,2,42]);
   writeln(arr.lengths);
}

If I compile with 'dmd multidimtest.d unstd/multidimarray.d', I 
get [1,2,42], as expected, but when I compile in release mode 
'dmd multidimtest.d unstd/multidimarray.d -release' I get 
[0,0,0]. Any ideas what might cause this?

Also, when I compile with -w (which I normally prefer) I get a 
list of errors of the type

unstd/multidimarray.d(101): Warning: calling 
unstd.multidimarray.MultidimArray!(double, 
3LU).MultidimArray.this without side effects discards return 
value of type inout(MultidimArray!(double, 3LU)), prepend a 
cast(void) if intentional

I've acted on these errors in the version I use for my HPC test 
code, and I have not noticed any deleterious effects; would you 
accept a pull request to fix these?

Kind regards,

Stefan Frijters


More information about the Digitalmars-d mailing list