No luck with initialising static arrays(was: setting statically sized multi-dimensional arrays)

Spacen Jasset spacenjasset at yahoo.co.uk
Mon Jan 28 08:22:06 PST 2008


 >
 > Try putting the "f" suffix on the first zeros in the second, third 
and foruth rows, too. It works for me:
 >
 > import std.math;
 >
 > void MakeRotationAboutX(float[4][4] m, float angle)
 > {
 >     m[] = [[1f, 0, 0, 0],
 >            [0f, cos(angle * PI / 180), sin(angle * PI / 180), 0],
 >            [0f, -sin(angle * PI / 180), cos(angle * PI / 180), 0],
 >            [0f, 0, 0, 1]];
 > }


It still fails with the same error, I did try adding the 'f' suffix, and 
it's probably needed, but that didn't fix it.

I have:

On windows:
Digital Mars D Compiler v1.015
Copyright (c) 1999-2007 by Digital Mars written by Walter Bright


And on linux:

gdc (GCC) 4.1.3 20070831 (prerelease gdc 0.25, using dmd 1.021) (Ubuntu 
0.25-4.1.2-16ubuntu1)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I can't find any example of this in the offical documentation, nor on 
google at the moment.


More information about the Digitalmars-d-learn mailing list