Neater "not version (...)" ?

Ferhat Kurtulmuş aferust at gmail.com
Wed Sep 16 18:07:25 UTC 2020


On Wednesday, 16 September 2020 at 17:53:31 UTC, Vladimirs 
Nordholm wrote:
> Hello.
>
> I wonder if there is a better way to compile something if the 
> current operating system is _not_ a specific platform.
>
> For example, I only want some code to compile if the operating 
> system is not Windows. Currently I do this:
>
>     version (Windows)
>     {
>     }
>     else
>     {
>         // ... my code
>     }
>
> Is there a neater version of this, like `!version (Windows) { 
> /+ ... my code +/ }` ?

Not what you may want, but a dub solution is available.
"excludeSourceFiles-windows" : ["source/someunixcode.d"]


More information about the Digitalmars-d-learn mailing list