| Thread overview | |||||
|---|---|---|---|---|---|
|
January 07, 2017 compile-time test against dmd/phobos version number | ||||
|---|---|---|---|---|
| ||||
Is there a way to make a compile time check against the dmd/phobos version number? Functionally, what I'd like to achieve would be equivalent to:
version(dmdVersion >= 2.070.1)
{
....
}
else
{
...
}
I think I've seen something like this, probably using 'static if', but can't find it now. What I'm really trying to do is test for existence of a specific enhancement in phobos, if it's present, use it, otherwise don't. Testing for a particular phobos release number seems the obvious thing to do.
--Jon
| ||||
January 07, 2017 Re: compile-time test against dmd/phobos version number | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jon Degenhardt | On Saturday, 7 January 2017 at 02:30:53 UTC, Jon Degenhardt wrote:
> Is there a way to make a compile time check against the dmd/phobos version number? Functionally, what I'd like to achieve would be equivalent to:
>
> version(dmdVersion >= 2.070.1)
> {
> ....
> }
> else
> {
> ...
> }
static if (__VERSION__ == 2072) { wow, it's dmd 2.072! }
| |||
January 07, 2017 Re: compile-time test against dmd/phobos version number | ||||
|---|---|---|---|---|
| ||||
Posted in reply to ketmar | On Saturday, 7 January 2017 at 02:41:54 UTC, ketmar wrote:
> On Saturday, 7 January 2017 at 02:30:53 UTC, Jon Degenhardt wrote:
>> Is there a way to make a compile time check against the dmd/phobos version number? Functionally, what I'd like to achieve would be equivalent to:
>>
>> version(dmdVersion >= 2.070.1)
>> {
>> ....
>> }
>> else
>> {
>> ...
>> }
>
> static if (__VERSION__ == 2072) { wow, it's dmd 2.072! }
Perfect, thank you!
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply