trick to avoid limits on run.dlang.io all compilers

Anonymouse zorael at gmail.com
Wed Jan 31 20:56:49 UTC 2024


On Wednesday, 31 January 2024 at 19:54:24 UTC, Steven 
Schveighoffer wrote:
> [...]

I also use it very often and I can relate.

> ```d
> static if(__VERSION__ >= 2100) {
>    // real test code
> } else void main() {}
> ```

This is what I generally do (at the very top of the file):

```d
static if (__VERSION__ < 2100)
     void main() {}
else:

import std;

void main()
{
     // ...
}
```

The `else:` looks *really* awkward and hacky, but it works.


More information about the Digitalmars-d mailing list