www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Checking Compiler version in code?

reply "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
Hey all,

I was wondering if there was a way to check the compiler version 
when running code. My project uses 2.064 and other people that go 
to use it will get errors if they haven't upgraded yet, and I'd 
like to make a check before hand so that if need be I can have a 
"Please upgrade to the most recent compiler" message show up or 
something.

Thanks!
Dec 05 2013
next sibling parent reply "Dicebot" <public dicebot.lv> writes:
On Thursday, 5 December 2013 at 18:40:53 UTC, Jeremy DeHaan wrote:
 Hey all,

 I was wondering if there was a way to check the compiler 
 version when running code. My project uses 2.064 and other 
 people that go to use it will get errors if they haven't 
 upgraded yet, and I'd like to make a check before hand so that 
 if need be I can have a "Please upgrade to the most recent 
 compiler" message show up or something.

 Thanks!
http://dlang.org/phobos/std_compiler.html
Dec 05 2013
parent "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
On Thursday, 5 December 2013 at 18:45:08 UTC, Dicebot wrote:
 On Thursday, 5 December 2013 at 18:40:53 UTC, Jeremy DeHaan 
 wrote:
 Hey all,

 I was wondering if there was a way to check the compiler 
 version when running code. My project uses 2.064 and other 
 people that go to use it will get errors if they haven't 
 upgraded yet, and I'd like to make a check before hand so that 
 if need be I can have a "Please upgrade to the most recent 
 compiler" message show up or something.

 Thanks!
http://dlang.org/phobos/std_compiler.html
How did I miss this? :P Thanks very much!
Dec 05 2013
prev sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Thu, Dec 05, 2013 at 07:40:51PM +0100, Jeremy DeHaan wrote:
 Hey all,
 
 I was wondering if there was a way to check the compiler version
 when running code. My project uses 2.064 and other people that go to
 use it will get errors if they haven't upgraded yet, and I'd like to
 make a check before hand so that if need be I can have a "Please
 upgrade to the most recent compiler" message show up or something.
[...] static if (__VERSION__ < 2064L) static assert(0, "Please upgrade to version 2.064 or later"); T -- ASCII stupid question, getty stupid ANSI.
Dec 05 2013
parent "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
On Thursday, 5 December 2013 at 19:43:09 UTC, H. S. Teoh wrote:
 On Thu, Dec 05, 2013 at 07:40:51PM +0100, Jeremy DeHaan wrote:
 Hey all,
 
 I was wondering if there was a way to check the compiler 
 version
 when running code. My project uses 2.064 and other people that 
 go to
 use it will get errors if they haven't upgraded yet, and I'd 
 like to
 make a check before hand so that if need be I can have a 
 "Please
 upgrade to the most recent compiler" message show up or 
 something.
[...] static if (__VERSION__ < 2064L) static assert(0, "Please upgrade to version 2.064 or later"); T
That's very interesting as well. Seeing things like this makes me realize how much more I have to learn about this language.
Dec 05 2013