On tis, 2007-08-21 at 20:16 +0200, Rudo Thomas wrote: > > > The second question is, should we use throw-specifications when > > > defining methods or simply document which exceptions are thrown? > > > > throw() specification on functions looks better to me, that way the > > compiler can also check if we throw something illegal. > > It is not that simple with C++: It is specifically allowed to throw an > exception that is not mentioned in the exception-specification (while > this could be detected in some cases, g++-3.4.6 does not print any > warnings). > > These situations are detected at run-time and if they happen, > unexpected() is called. See the C++ Standard, section 15.4, par 8 to 10.
Ok, still, better to detect them at runtime than to get an exception being thrown around that isn't handled properly because we didn't expect it. /Anders
