July 06, 2004 out parameters not initialised | ||||
---|---|---|---|---|
| ||||
Using DMD 0.94, Windows 98SE.
function.html
out parameters are set to the default initializer for the type of it. For example:
void foo(out int bar)
{
}
int bar = 3;
foo(bar);
// bar is now 0
No it isn't! A simple printf anywhere in this code suffices to show that the initialisation never happens. The same occurs whether it's a primitive type, array or struct.
I.e. the compiler hasn't been taught the difference between inout and out.
Stewart.
--
My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
|
Copyright © 1999-2021 by the D Language Foundation