ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1000. A+B Problem

TO ADMINS
Послано andreyDagger`~ 23 дек 2024 15:22
Why is this code gives Runtime Error? I think it's not a problem to allow participants use exceptions, as long as they are not throwing it out of main:

#include <iostream>

int main() {
    int a, b;
    std::cin >> a >> b;
    try {
        throw std::exception();
    } catch (...) {}
    std::cout << a + b << "\n";
}
Re: TO ADMINS
Послано Vladimir Yakovlev (USU) 24 янв 2025 06:05
For some old C++ compilers it was impossible to determine whether the exception is caught or not. At the same time there are very little practical use cases for using exceptions in C++ solutions. So, there was no reason in trying to fix the issue.

I don't know if the modern compilers already made it possible to determine. But even if they do I would still keep this feature disallowed because it takes reasonable effort to verify that a not so popular feature works properly on each new version of each of the C++ compilers.
Re: TO ADMINS
Послано andreyDagger`~ 26 янв 2025 15:07
Thanks for clarification. I was solving problem 1074 and thought it is a good idea to throw exception if parsing is failed somewhere in the depth of recursion. But yeah, this is the only problem from all of the archive where I wanted to use exceptions