Fractal wrote:
if I have the following code:

int foo; foo = 5;

When the variable foo is declared, it is initialized to int.init, or
has garbage contents until it is assigned?


Here's the easy way to find out:

int bar()
{   int foo;
    foo = 5;
    return foo;
}

compile with:

dmd -c test -O -release

and disassemble with:

obj2asm test.obj

to show the generated code is:

_D4test3barFZi  comdat
                mov     EAX,5
                ret

Reply via email to