www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Get third part of front-end version number

reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
These days, DMD/DMDFE version numbers are three parts, ex: 2.070.1.

I can get the first two via std.compiler.version_major and 
std.compiler.version_minor. Is there a way to get the third part?

I know I can "dmd --help | grep DMD", but that only works for DMD. GDC's 
"gdc --version" doesn't appear to show the DMDFE version, and I have no 
idea about LDC.

Or is the third part of the DMDFE version completely irrelevant to LDC/GDC?
Apr 05 2016
parent reply Johan Engelen <j j.nl> writes:
On Tuesday, 5 April 2016 at 18:01:05 UTC, Nick Sabalausky wrote:
 These days, DMD/DMDFE version numbers are three parts, ex: 
 2.070.1.

 I can get the first two via std.compiler.version_major and 
 std.compiler.version_minor. Is there a way to get the third 
 part?

 I know I can "dmd --help | grep DMD", but that only works for 
 DMD. GDC's "gdc --version" doesn't appear to show the DMDFE 
 version, and I have no idea about LDC.
"ldc2 --version" will give you the full DMDFE version it is based on. E.g. ❯ bin/ldc2 --version LDC - the LLVM D compiler (dff841): based on DMD v2.068.2 and LLVM 3.8.0svn-r262738
Apr 05 2016
parent Steven Schveighoffer <schveiguy yahoo.com> writes:
On 4/5/16 2:11 PM, Johan Engelen wrote:
 On Tuesday, 5 April 2016 at 18:01:05 UTC, Nick Sabalausky wrote:
 These days, DMD/DMDFE version numbers are three parts, ex: 2.070.1.

 I can get the first two via std.compiler.version_major and
 std.compiler.version_minor. Is there a way to get the third part?

 I know I can "dmd --help | grep DMD", but that only works for DMD.
 GDC's "gdc --version" doesn't appear to show the DMDFE version, and I
 have no idea about LDC.
"ldc2 --version" will give you the full DMDFE version it is based on. E.g. ❯ bin/ldc2 --version LDC - the LLVM D compiler (dff841): based on DMD v2.068.2 and LLVM 3.8.0svn-r262738
Note dmd --version works too. This was added a few releases ago. As for getting it inside the code itself, I'm not sure. Docs here is how std.compiler does it: http://dlang.org/spec/lex.html#specialtokens Don't see a way to get patch number. Technically, it shouldn't matter, as there should be no functional changes in the patches, just regression fixes. In other words, anything compiled with 2.x.n should be compilable with 2.x.n+1 I realize reality isn't always so nice though. -Steve
Apr 07 2016