On Friday, 23 November 2012 at 11:38:31 UTC, Gor Gyolchanyan
wrote:
What's the best/standard way translating this to D?
One way is to use import expressions:
import std.stdio;
import std.conv;
enum value = import("value").to!int();
void main()
{
static if (value < 100)
writeln("<100");
else
writeln(">100");
}
Compile using:
dmd -Jpath/to/value source.d
"value" should be a file containing a single integer with no new
line. It will be read in at compile time and converted to a
manifest integer constant, which you can use in static if
statements.