Casts and some suggestions to avoid them

Meta jared771 at gmail.com
Wed Apr 9 15:54:50 PDT 2014


On Wednesday, 9 April 2014 at 21:18:38 UTC, bearophile wrote:
>> I have also counted about 38 unsorted casts that don't easily 
>> fit in the precedent categories. They are so varied that it's 
>> not easy to find ways to avoid them.
>
> In my post I have not shown examples of the casts for the this 
> "unsorted" category. They are sometimes needed to work around 
> compiler bugs, like this one (the code doesn't compile if you 
> remove the cast):
>
> void main() {
>     enum E { a, b }
>     int[E][E] foo =
>         cast()[E.a: [E.a: 1, E.b: 2],
>                E.b: [E.a: 3, E.b: 4]];
> }
>
>
> Bye,
> bearophile

I forgot that nested AAs were even possible. I was thinking about 
this yesterday and was positive that they weren't.


More information about the Digitalmars-d mailing list