www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compiler support for T(n) notation for initialization of variables

reply Joseph Rushton Wakeling via Digitalmars-d-learn writes:
Hello all,

Just a quick check -- which version of the dmd frontend introduces support for 
the notation T(n) to initialize a variable as type T?  Is it 2.065 or the 
upcoming 2.066?  I ask because as I'm always running git-HEAD DMD, I'm never 
entirely on top of what's in which version ... :-)

Thanks & best wishes,

     -- Joe
Jun 07 2014
next sibling parent reply "Peter Alexander" <peter.alexander.au gmail.com> writes:
Well, it doesn't work in 2.065, so must be 2.066 :-)

P.S. thanks for letting me know about this feature. I had no idea 
it was going in!
Jun 07 2014
parent Joseph Rushton Wakeling via Digitalmars-d-learn writes:
On 07/06/14 19:57, Peter Alexander via Digitalmars-d-learn wrote:
 Well, it doesn't work in 2.065, so must be 2.066 :-)

 P.S. thanks for letting me know about this feature. I had no idea it was going
in!
I only discovered it when I was advised to use it in a recent Phobos PR of mine. :-) The reason I wanted to know is to check whether or not it was "safe" to use it in library code that might conceivably be used with earlier compilers. I think requiring 2.065+ is reasonable, but requiring 2.066 obviously is not. Oh well, (cast(T) 1) it is then. :-( (I think that to!T will also work with a compile time constant, but it feels a bit dodgy to import std.conv for something like this.)
Jun 07 2014
prev sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Joseph Rushton Wakeling:

 which version of the dmd frontend introduces support for the 
 notation T(n) to initialize a variable as type T?  Is it 2.065 
 or the upcoming 2.066?
In 2.066. Bye, bearophile
Jun 07 2014
parent Joseph Rushton Wakeling via Digitalmars-d-learn writes:
On 07/06/14 19:57, bearophile via Digitalmars-d-learn wrote:
 Joseph Rushton Wakeling:

 which version of the dmd frontend introduces support for the notation T(n) to
 initialize a variable as type T?  Is it 2.065 or the upcoming 2.066?
In 2.066.
Thanks for the confirmation :-)
Jun 07 2014