Casts and some suggestions to avoid them
bearophile
bearophileHUGS at lycos.com
Wed Apr 9 14:18:36 PDT 2014
> 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
More information about the Digitalmars-d
mailing list