...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <cstdlib>
void throwing_func() noexcept(false);
void f() { // never invoked by program except as exit handler
throwing_func();
}
int main() {
if (0 != std::atexit(f)) {
// Handle error
}
// ...
} |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <cstdlib>
void throwing_func() noexcept(false);
void f() { // never invoked by program except as exit handler
try {
throwing_func();
} catch (...) {
// Handle error
}
}
int main() {
if (0 != std::atexit(f)) {
// Handle error
}
// ...
} |
...