A switch bug

bearophile bearophileHUGS at lycos.com
Tue May 31 04:37:01 PDT 2011


In this case I have not appreciated implicit char <-> int conversions in D (this comes from a bug of mine):


void main(string[] args) {
    foreach (c; args[1])
        switch (c) {
            case 0: .. case 9: // do something with the digit
            default:
        }
}


Bye,
bearophile


More information about the Digitalmars-d-learn mailing list