www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - 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.
Jul 06 2004