version(StdDoc)

Stanislav Blinov stanislav.blinov at gmail.com
Sat Nov 24 16:28:47 UTC 2018


On Saturday, 24 November 2018 at 07:00:31 UTC, Jonathan M Davis 
wrote:

> [not legal]
>
> enum Foo
> {
>     a,
>     b,
>     version(linux) c = 42,
>     else version(Windows) c = 54,
> }
>
> You're forced to version the entire enum.

Not in this case, no:

enum Foo
{
     a,
     b,
     c = {
        version(linux) return 42;
        else version(Windows) return 54;
     } ()
}

/pedantry


More information about the Digitalmars-d-learn mailing list