Types soup with enum and bool

bearophile bearophileHUGS at lycos.com
Tue Oct 29 05:43:16 PDT 2013


This code is accepted by the D compiler:


enum Foo { A, B, C }
void main() {
     bool[5] bools;
     auto b = bools[2] != Foo.C;
     bools[2] = Foo.A;
}


Who is that likes such kind of code? What are the advantages of 
accepting such kind of code? I can see the disadvantages and 
risks.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list