I'm learning D, and am confused by an error I'm getting.
Consider the following:
module helloworld;
import std.stdio;
import std.perf;
ptrdiff_t main( string[] args )
{
auto t = new PerformanceCounter; //From managed heap
//PerformanceCounter t; //On the stack
t.start();
writeln( "Hello, ", size_t.sizeof * 8, "-bit world!" );
t.stop();
writeln( "Elapsed time: ", t.microseconds, " \xb5s." );
return 0;
} //main()
Yields a perfectly respectable:
Hello, 32-bit world!
Elapsed time: 218 µs.
Now consider what happens when I attempt to initialize PerformanceCounter on the stack instead of using the managed heap:
//auto t = new PerformanceCounter; //From managed heap
PerformanceCounter t; //On the stack
Yields:
--- killed by signal 10
I'm stumped. Any thoughts as to why this breaks? (DMD 2.049 on Mac OS X 10.6.4). Thanks in advance for helping a n00b.