enum : bool

Jarrett Billingsley kb3ctd2 at yahoo.com
Thu Jun 12 16:19:11 PDT 2008


"BCS" <ao at pathlink.com> wrote in message 
news:55391cb32e20b8ca9ab3c6527b36 at news.digitalmars.com...
>
> This works
>
> enum Test : bool
> {
> yes = true,
> no = false
> }
>
> void TestIt(Test);
>
> TestIt(Test.yes);
>
>
> Is any one makeing use of it? It allows for more usefull nameing.

Would've been funny if

enum MyBool : bool
{
    True,
    False,
    FileNotFound
}

worked but alas, the compiler (shockingly!) isn't buggy and errors on the 
overflow.. 




More information about the Digitalmars-d-learn mailing list