ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1000. A+B Problem

TO ADMINS
Posted by andreyDagger`~ 23 Dec 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
Posted by Vladimir Yakovlev (USU) 24 Jan 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
Posted by andreyDagger`~ 26 Jan 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