Magic infinite loop inside foreach
MrSmith
mrsmith33 at yandex.ru
Thu Jan 30 14:56:44 PST 2014
I have some function which does some matrix calculations and
prints them. It is actually calculationg determinant of the
matrix and i need to call those functions several times in the
loop, until i get the final result. Here is the code.
void solveAndPrint(T : CoeffMatrix!(ElementType, ElementType),
ElementType)(T _matrix)
{
auto matrix = _matrix;
TempMatrix!ElementType temp;
foreach(_; 0..3) //3 is just for debug
{
writeln(matrix);
temp = makeTemp(matrix);
writeln(temp);
matrix = solveTemp(temp);
writeln("done1");
stdout.flush();
}
writeln("done2");
stdout.flush();
}
The problem is that after 'done1' is printed it is running
infinitely consuming all the processor just like if has infinite
loop inside. done2 is never printed.
More information about the Digitalmars-d-learn
mailing list