TickDuration = Divide by Zero

Chris Williams yoreanon-chrisw at yahoo.co.jp
Mon Oct 3 09:09:31 PDT 2011


I have the following code:

import std.datetime;

const TickDuration a;
static this() {
	a = TickDuration.from!"msecs"(15_000);
}

int main() {
	writefln("Hello world!"); // is never printed

	return 0;
}

When I run it, I get the following output:

object.Error: Integer Divide by Zero

I presume that TickDuration is trying to access something that it
doesn't have access to yet, during startup. Is there another way to
make my constant a constant?


More information about the Digitalmars-d-learn mailing list