|
|
back to boardTO ADMINS 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 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 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 |
|
|