[Issue 953] Multiple C style declarations of same type cannot be in one statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 10 05:10:35 PDT 2009


Witold Baryluk <baryluk at smp.if.uj.edu.pl> changed:

           What    |Removed                     |Added
                 CC|                            |baryluk at smp.if.uj.edu.pl

--- Comment #3 from Witold Baryluk <baryluk at smp.if.uj.edu.pl>  2009-08-10 05:10:34 PDT ---
Hi, i just tried in DMD 1.043

int a[8], c[8];

and given me this nonsensical error. I know this is redudant, but is there to
allow C style declarations. I just switch many times from C to D, and sometimes
forgot where am I.

In declarations.html we read:
"In a declaration declaring multiple symbols, all the declarations must be of
the same type:
 int x,y;    // x and y are ints
 int* x,y;    // x and y are pointers to ints
 int x,*y;    // error, multiple types
 int[] x,y;    // x and y are arrays of ints
 int x[],y;    // error, multiple types

I was all my life (actually life when i use D, so about 3 years) thinking this
means, that:

int[8] a,b,c;

is equivalent of

int a[8], b[8], c[8];

how about adding to spec example this entries:
 int[2] x,y;     // x and y are static arrays of ints
 int x[2],y;     // error, multiple types
 int x[2],y[2];  // error, multiple types
 int x[2],y[3];  // error, multiple types

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

More information about the Digitalmars-d-bugs mailing list