Liste des Groupes | Revenir à cl c++ |
David Brown writes:It might be obvious to you, but not for everybody. What exact problem can be solved by validating thrown exception classes at compile time? And how would a developer of a base class know which exceptions I might want to throw from an overridden virtual function in a derived class, which might be developed and compiled fully separately from the base class?
I think it became fairly quickly apparent that "throw(...)" specifiers were not as useful in practice as had been hoped, and relatively few programmers used them except in the form "throw()". So "throw(...)" was deprecated in C++11 and has been valid until C++17 (with compilers implementations being free to accept it as a non-standard extension far beyond that).It should be painfully obvious that the right thing to do should've been to merge throw specifications into function signatures, allowing exception handling to be validated at compile-time, i.e. what Java did. Instead of that we have the current state of affairs where the only
Les messages affichés proviennent d'usenet.