enums and version/static if/"inheritance"

Max Samukha maxsamukha at gmail.com
Wed Jul 31 16:04:43 UTC 2024


On Wednesday, 31 July 2024 at 06:11:15 UTC, Walter Bright wrote:

> version (x86_64)
> {
>     enum FOO
>     {
>        A = 5,
>        B = 6,
>        C = 7,
>     }
> }
> else version (AArch64)
> {
>    enum FOO
>    {
>        A = 5,
>        B = 6,
>        C = 17,
>    }
> }
> else
>     static assert(0);
> ```
>
> Ah, doesn't that look nicer?

It's been said maybe a billion times why this solution rarely 
works in the read world. And the arguments have been dismissed in 
the classic D way.


More information about the Digitalmars-d mailing list