K
Karl Heinz Buchegger
Kai-Uwe Bux said:Karl Heinz Buchegger wrote:
[snip]int main()
{
Matrix a(2), b(3), c;
time_t start, end;
start = clock();
for( int j = 0; j < 100000; ++j )
c = a + b;
end = clock();
Are you sure the compiler did not optimize away all of the loop?
After all, neither a nor b nor c are changing.#
Thats what I initially thought also.
But then I tried an experiment: I increased the number
of iterations and with that the time increased. For me
this is evicence enough that the loop is not
optimized away entirely.