I tried to check how many recursions causes stack overflow. But why doesn't the following code output anything?
#include <iostream>
#include <exception>
int counter = 0;
void endlessloop() try {
++counter;
endlessloop();
} catch (std::exception &e) {
std::cout << "Call stack overflew. Counter: " << counter << std::endl <<
"Exception: " << e.what() << std::endl;
}
int main() {
endlessloop();
return 0;
}