www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - MatrixFixed(T, int ROWS, int COLUMNS)

reply sclytrack pi.be writes:
Definition:

struct MatrixFixed(T, int ROWS, int COLUMNS)
{
private:
T data[ROWS, COLUMNS];

Usage:

alias MatrixFixed!(double, 2 , 2) Matrix4x4;

Error:

./dxl/dnl/matrixfixed.d(23): Integer constant expression expected instead of 2
, 2


Version:

Digital Mars D Compiler v0.154
Copyright (c) 1999-2006 by Digital Mars written by Walter Bright
Documentation: www.digitalmars.com/d/index.html

Question:
I was wondering if anybody could replicate this.
I want to know if it is a compiler bug, my bug, or just my computer being lazy.
Jun 01 2006
next sibling parent sclytrack pi.be writes:
T data[ROWS][COLUMNS];

my bug.

In article <e5m4ln$2huc$1 digitaldaemon.com>, sclytrack pi.be says...
Definition:

struct MatrixFixed(T, int ROWS, int COLUMNS)
{
private:
T data[ROWS, COLUMNS];

Usage:

alias MatrixFixed!(double, 2 , 2) Matrix4x4;

Error:

./dxl/dnl/matrixfixed.d(23): Integer constant expression expected instead of 2
, 2


Version:

Digital Mars D Compiler v0.154
Copyright (c) 1999-2006 by Digital Mars written by Walter Bright
Documentation: www.digitalmars.com/d/index.html

Question:
I was wondering if anybody could replicate this.
I want to know if it is a compiler bug, my bug, or just my computer being lazy.

Jun 01 2006
prev sibling parent Derek Parnell <derek psych.ward> writes:
On Thu, 1 Jun 2006 07:23:36 +0000 (UTC), sclytrack pi.be wrote:

 Definition:
 
 struct MatrixFixed(T, int ROWS, int COLUMNS)
 {
 private:
 T data[ROWS, COLUMNS];
 
 Usage:
 
 alias MatrixFixed!(double, 2 , 2) Matrix4x4;
 
 Error:
 
 ./dxl/dnl/matrixfixed.d(23): Integer constant expression expected instead of 2
 , 2

The multi-dimensional array syntax is wrong. Try this instead .... T data[ROWS][COLUMNS]; -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocracy!" 1/06/2006 5:43:49 PM
Jun 01 2006