Not initialized array issue
I have following sample code:
import std.stdio;
void test1(string s)
{
}
void main(string[] args)
{
writeln(args);
string[] test = ["aaa", "bbb"];
test1(test[0]);
}
In Visual Studio I set breakpint on the writeln(args) statement. In debugger there are 2 variables shown:
| Name | Wert | Typ | |
|---|---|---|---|
| ▶ | args | {length=1 ptr=0x0019fe2c} | const(char)[][] |
| ▶ | test | {length=4267205 ptr=0x00000000} | const(char)[][] |
The array test isn't available at this point of time, By clicking on the expand button there is a warning shown that this will take some time due to the huge amount of items.
That are the woes of uninitialized memory. I've added emitting lifetime information for variables to the compiler, but it's not perfectly accurate. test isn't supposed to be available on the line with writeln, but on the next one which will show the same result.
I don't think there is anything the debugger can do about it but wait for the compiler to emit better debug info.