www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - feature request: compiler switch to output compiler defined version constants

reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
It would be nice if dmd -showversions output all the version constants 
defined by the compiler.  Why do I say this?  Because it's much more 
convenient than searching through the digital mars web site for predefined 
constants, then trying to figure out if those constants are defined or not 
by trying to compile a file with those version constants in it.  And this 
should be done in both D 1.0 and 2.0, as it doesn't affect the language.

BTW, if there is already some way to do this, please let me know :)

-Steve 
Oct 22 2007
next sibling parent BCS <BCS pathlink.com> writes:
Steven Schveighoffer wrote:
 It would be nice if dmd -showversions output all the version constants 
 defined by the compiler.  Why do I say this?  Because it's much more 
 convenient than searching through the digital mars web site for predefined 
 constants, then trying to figure out if those constants are defined or not 
 by trying to compile a file with those version constants in it.  And this 
 should be done in both D 1.0 and 2.0, as it doesn't affect the language.
 
 BTW, if there is already some way to do this, please let me know :)
 
 -Steve 
 
 
you still need to find the things to check but this will give you a yes no: mixin(DefinedP!("ver123")); template DefinedP(char[] ver) { const char[] DefinedP = "version("~ver~"){pragma(msg,`+"~ver~"`)}else{pragma(msg,`-"~ver~"`)}"; }
Oct 22 2007
prev sibling next sibling parent Bruce Adams <tortoise_74 yeah.who.co.uk> writes:
Steven Schveighoffer Wrote:

 It would be nice if dmd -showversions output all the version constants 
 defined by the compiler.  Why do I say this?  Because it's much more 
 convenient than searching through the digital mars web site for predefined 
 constants, then trying to figure out if those constants are defined or not 
 by trying to compile a file with those version constants in it.  And this 
 should be done in both D 1.0 and 2.0, as it doesn't affect the language.
 
 BTW, if there is already some way to do this, please let me know :)
 
 -Steve 
 
 
This sort of thing would be really useful for generating a configure script.
Oct 22 2007
prev sibling parent "Stewart Gordon" <smjg_1998 yahoo.com> writes:
"Steven Schveighoffer" <schveiguy yahoo.com> wrote in message 
news:ffiv9s$b0p$1 digitalmars.com...
 It would be nice if dmd -showversions output all the version constants 
 defined by the compiler.
<snip> I proposed this and more about a year ago: http://www.digitalmars.com/d/archives/digitalmars/D/42154.html
 And this should be done in both D 1.0 and 2.0, as it doesn't affect the 
 language.
You mean DMD 1.x and 2.x I presume. Stewart. -- My e-mail address is valid but not my primary mailbox. Please keep replies on the 'group where everybody may benefit.
Oct 24 2007