Walter Bright wrote:
Bill Baxter wrote:
version(int) is like a programming language with one variable. It's
ridiculous.
One variable, and one operator, >=.
To be fair, it was clearly intended to refer to the version of the
final user's app, not a library version or platform version or
anything else.
But to assume that only apps have versions, and that >= is the only
test you'd ever want to perform is, I agree, pretty silly.
The way to use it would be:
version (2)
{
version = HasFeatureX;
version = HasFeatureY;
version = HasFeatureZ;
}
...
version (HasFeatureY)
{
...
}
You cannot use version(int) inside libraries. You can only use it for
the app. But it's fairly common to have multiple library versions.