trick to avoid limits on run.dlang.io all compilers
Steven Schveighoffer
schveiguy at gmail.com
Wed Jan 31 21:09:12 UTC 2024
On Wednesday, 31 January 2024 at 20:56:49 UTC, Anonymouse wrote:
> 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()
> {
> // ...
> }
> ```
Ah, very nice! Easy to paste this in at the top! I'll have to
remember that.
> The `else:` looks *really* awkward and hacky, but it works.
It's a nice feature of `static if` and `version` that works at
declaration level. This is what it is intended for (to avoid
indentation issues).
-Steve
More information about the Digitalmars-d
mailing list