Thread overview
array operations
Oct 19, 2002
Sean L. Palmer
Oct 19, 2002
Mike Wynn
Oct 19, 2002
Sean L. Palmer
Nov 12, 2002
Walter
October 19, 2002
I thought you had these in already?

alias float[3] Vc3;
int main(char[][] args)
{
    Vc3 a,b,c;
    a[] = b[] + c[];
    return 0;
}
testvector.d(27): Array operations not implemented

And I will need to be able to initialize arrays with array literals, such as:

    float[3] up   = { 0, 1, 0 };
    float[3] down = { 0,-1, 0 };
testvector.d(22): Error: a struct is not a valid initializer for a float[3]

This initialization stuff is so fundamental that I can't get far without it.  It's very tedious to write:

    float[3] up;
    up[0] = 0;
    up[1] = 1;
    up[2] = 0;

And not only that but it's impossible to initialize global or static arrays properly, at point of declaration; you have to do it inside a function like main.

    Vc3 a,b,c;
    a[0] = b[0] + c[0];
    a[1] = b[1] + c[1];
    a[2] = b[2] + c[2];
    return 0;
If I wanted to do that I would use C.

Bother.

Maybe I'll try overloading my own operators, see if that works yet.

Sean


October 19, 2002
try

    float[3] up   = [ 0, 1, 0 ];
    float[3] down = [ 0,-1, 0 ];
  "Sean L. Palmer" <seanpalmer@directvinternet.com> wrote in message news:aos8r1$2hbf$1@digitaldaemon.com...

  And I will need to be able to initialize arrays with array literals, such as:

      float[3] up   = { 0, 1, 0 };
      float[3] down = { 0,-1, 0 };
  testvector.d(22): Error: a struct is not a valid initializer for a float[3]





October 19, 2002
You're right, but in the Examples under Array Operations it says:

int[] def = { 1, 2, 3 };	// dynamic array of 3 ints

This is dynamic array instead of normal but should be same syntax, right?

Sean
  "Mike Wynn" <mike.wynn@l8night.co.uk> wrote in message news:aosd4a$2l97$1@digitaldaemon.com...
  try

      float[3] up   = [ 0, 1, 0 ];
      float[3] down = [ 0,-1, 0 ];
    "Sean L. Palmer" <seanpalmer@directvinternet.com> wrote in message news:aos8r1$2hbf$1@digitaldaemon.com...

    And I will need to be able to initialize arrays with array literals, such as:

        float[3] up   = { 0, 1, 0 };
        float[3] down = { 0,-1, 0 };
    testvector.d(22): Error: a struct is not a valid initializer for a float[3]




November 12, 2002
The example is wrong, it should be [], not {}. -Walter
  "Sean L. Palmer" <seanpalmer@directvinternet.com> wrote in message news:aosm19$2u69$1@digitaldaemon.com...
  You're right, but in the Examples under Array Operations it says:

  int[] def = { 1, 2, 3 }; // dynamic array of 3 ints

  This is dynamic array instead of normal but should be same syntax, right?

  Sean
    "Mike Wynn" <mike.wynn@l8night.co.uk> wrote in message news:aosd4a$2l97$1@digitaldaemon.com...
    try

        float[3] up   = [ 0, 1, 0 ];
        float[3] down = [ 0,-1, 0 ];
      "Sean L. Palmer" <seanpalmer@directvinternet.com> wrote in message news:aos8r1$2hbf$1@digitaldaemon.com...

      And I will need to be able to initialize arrays with array literals, such as:

          float[3] up   = { 0, 1, 0 };
          float[3] down = { 0,-1, 0 };
      testvector.d(22): Error: a struct is not a valid initializer for a float[3]