What will be printed as a result of the following program:
#include <iostream>

void f() {
     throw 10;

int main() {
    try {
    } catch (...) {
        std::cout << "all ";
    } catch (double) {
        std::cout << "double ";
    } catch (int) {
        std::cout << "int ";
    return 0;
The catch(...) block {/*....*/} must be the last in the series of exception traps. Standard 15.3.6 Otherwise, this block will always be controlled if an exception occurs, regardless of whether there is a more suitable processing block for the excited exception or not (in this case, if there was no compilation error, catch(int) would be skipped).

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты