gdc --version doesn't indicate which D front-end version it's compatible with

Siarhei Siamashka siarhei.siamashka at gmail.com
Fri Jan 28 23:42:09 UTC 2022


On Friday, 28 January 2022 at 17:45:32 UTC, singingbush wrote:
>> It would be far more helpful if running `gdc --version` gave 
>> some indication of the version of D it's aligned to (which was 
>> 2.076 last time I checked).

This would be indeed nice. But so far we have to compile and run 
the following code:

```D
import std.stdio, std.compiler;

void main()
{
   writeln(version_major, ".", version_minor);
}
```

It's ironic that I have exactly the opposite problem. I need to 
check for the backend version from inside of the running program, 
and this isn't easy. I resorted to using this hack:

```D
// GDC11 was the first version to start supporting getTargetInfo 
traits
bool detect_gdc11()
{
   version(GNU) { return __traits(compiles, 
__traits(getTargetInfo, "cppStd")); }
   else return false;
}
```

> Just seen 
> https://forum.dlang.org/thread/nuphsvwkdlygdcxaihwf@forum.dlang.org about D 2.098 being in GCC, still can't tell if that's what I have based on the output though.

It landed in the git repository and is going to be released as 
part of GDC 12.


More information about the D.gnu mailing list