D aliases vs. C typedefs
monarch_dodra via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 10 13:48:23 PDT 2014
On Tuesday, 10 June 2014 at 20:33:03 UTC, Ali Çehreli wrote:
> I think they are actually legal: This is D's support of C-style
> array declaration acting the same in alias declaration:
>
> Ali
C-style array declaration has got to be one of C's *worst*
abominations. There's no real *technical* rationale for it either.
I am ***INCREDIBLY*** glad D's stance is simply "depth first left
to right". It *supports* C style, but unless you are copy pasting
some C code, you'd have to be mad in your head to actually ever
use it.
Honestly, try to declare:
*A two element array of pointers to int
*A pointer to a two element array of ints
Tip: the solutions are in this set:
int *arr1[2];
int (*arr2)[2];
int *(arr3[2]);
Also, the syntax is *so* horrible, the syntax is actually
deprecated in D. And that's saying a lot, when you know how much
Walter hates breaking code...
More information about the Digitalmars-d-learn
mailing list