Mixing array prefix/postfix declaration

simendsjo simen.endsjo at pandavre.com
Sun Apr 3 07:57:38 PDT 2011


The following is illegal:
int a, *b; // multiple declarations must have the same type, not int and int*

C style functions is also deprecated.

C style array declarations is still supported (but frowned upon..?).

But why are C and D style array declarations supported on the same declaration?
Isn't this both confusing and unnecessary?

// D style
int[2][1] a;
static assert(is(typeof(a) == int[2][1]));

// C style
int b[1][2];
static assert(is(typeof(b) == int[2][1]));

// Mixed
int[4][3] c[1][2];
static assert(is(typeof(c) == int[4][3][2][1]));


More information about the Digitalmars-d-learn mailing list