d的实错误问题
原文
在四个条件下会出错:
import std.stdio;
import std.datetime;
alias T = real; // 必须为'real'
enum testCount = 7; // 必须> 6
T foo() { // 必须返回值
return 42;
}
void main() {
// 必须转为空.
const m = benchmark!(() => cast(void)foo)(testCount);
writeln(m[0].msecs);
}
然后,输出为-9223372036854775808等等.
阿里,我修改了:
import std.stdio;
//原:import std.datetime;
import std.datetime.stopwatch;
alias T = real; // 必须为'real'
enum testCount = 7; // 必须> 6
T foo() { // 必须返回值
return 42;
}
void main() {
// 必须转为空.
const m = benchmark!(() => cast(void)foo)(testCount);
//writeln(m[0].msecs);
//修改为:
writeln(m[0].total!"msecs");
}
然后,正常编译了.
浙公网安备 33010602011771号