On Wednesday, 27 July 2022 at 03:42:07 UTC, Walter Bright wrote:
>On 7/26/2022 3:52 AM, Andrey Zherikov wrote:
>But how should I check that a specific feature is added to compiler/phobos or a specific bug is fixed?
Create a single "configuration module", which has a section for each version:
module config;
version (DigitalMars)
{
import digitalmars;
}
else version (LDC)
{
import ldc;
}
else version (GDC)
{
import gdc;
}
else
{
static assert(0, "unsupported system");
}
Now, in digitalmars.d and ldc.d and gdc.d, do what it takes to make that configuration work for your code.
This makes it really easy to concentrate, say, in ldc.d, just on ldc's characteristics. Rather than having to constantly confuse yourself with which configuration is compiling what code.
What's your recommendation about how I should check for a specific feature/bugfix? Should I use static if(__VERSION__ ...)
, static if(__traits(compiles, { ... }))
or something else?