D aliases vs. C typedefs

Tom Browder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 10 13:18:03 PDT 2014


On Tue, Jun 10, 2014 at 3:05 PM, Ali Çehreli
<digitalmars-d-learn at puremagic.com> wrote:
> On 06/10/2014 12:40 PM, Tom Browder via Digitalmars-d-learn wrote:
...
> That's the old syntax. As you note below, the newer syntax uses the = sign.
> My alias chapter uses the new syntax as well:
>
>   http://ddili.org/ders/d.en/alias.html

I forgot to look there, sorry.

>> // these compile but have no C equivalent that I know of, but what do
>> // the aliases represent?
>>
>> alias int[2] val5[2];     // D: a 2-dimensional array of ints? (int[2][2])
>> ?
>
> Pretty strange. :)
>
>     pragma(msg, val5);
>
> outputs this:
>
> int[2][2]

Okay, checks with my guess.

>> alias int[4] val6[2];     // D:  a 2-dimensional array of ints?
>> (int[4][2]) ?
>> alias int    val7[2];      // D:  a 1-dimensional array of ints? (int[2])
>> ?
>
> I don't know whether those are legal. I hope not. :)

I agree, but they compile!  If they are not legal, why am I getting no errors?

I'll try the pragma on the others.

Thanks, Ali.

-Tom



More information about the Digitalmars-d-learn mailing list