3 ms·
The example from the slide is a range-for: https://en.cppreference.com/w/cpp/language/range-for https://en.cppreference.com/w/cpp/language/range-for My interp
by al2o3cr 3y ago
The example from the slide is a range-for:
https://en.cppreference.com/w/cpp/language/range-for https://en.cppreference.com/w/cpp/language/range-for
My interpretation is that the compiler isn't able to recognize that iterating over a "std::map" doesn't have side-effects, so it can't recognize that the loop is "dead code" that does nothing.
For instance, optimizing compilers will remove this loop entirely:
int fun_with_dead_loop() {
for(int i=0; i < 10; i++) {
}
return 0;
}
In the case of the patch, I believe the author of the text accidentally combined two similar English idioms "deadlock" and "infinite loop".