www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - "out" always works as "inout"?

reply Nick <Nick_member pathlink.com> writes:
I've understood the documentation correctly, using "out" in a parameter
declaration should "blank out" the variable, but this doesn't seem to work:

void main()
{
void func(out int i) {}

int i = 10;
printf("%d\n", i);
func(i);		// i should be set to 0, but is not
printf("%d, should be %d\n", i, int.init);
}

Nick
Jul 20 2004
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
derek parnell on the main D messageboard had the same problem.  i swear out
worked correctly in 0.94.
Jul 20 2004
prev sibling parent "Walter" <newshound digitalmars.com> writes:
It's a known bug, and it'll be fixed in the next update. -Walter
Jul 20 2004