Because I had no time to do a puzzle today myself and there was still one from my former colleague Thomas in the queue I will present this puzzle today.
The question is what the following application does produce when built with a standard compliant compiler.
#include <iostream>
struct A {};
void foo(bool t) {
if (t)
throw A();
}
void bar(bool t) {
try {
try {
foo(t);
throw;
} catch (const A&) {
std::cout << "catched const A&" << std::endl;
throw;
}
} catch (...) {
std::cout << "catched ..." << std::endl;
}
}
int main() {
bar(true);
bar(false);
std::cout << "done." << std::endl;
}

No comments:
Post a Comment