[Debtags-devel] Exception issues in Debtags::Environment

Benjamin Mesing bensmail@gmx.net
Sun, 05 Sep 2004 08:05:41 +0200


Hello,

> You raise an important issue here, which is quite annoying to me because
> gcc doesn't care about issuing warnings when throw declarations are
> obviously wrong, so that in the end you may change some low-level code
> and find out that your whole hierarchy of throw declarations is wrong.
That is something I do not understand either. Stroustrup write that most
of the exception specification checking could and should be done by the
compiler so it can issue a warning, but perhaps the guys from the gcc do
not care :-(

> A tempting way out would be to shout some colorful italian curse and
> then to remove all throw declarations from prototypes, making all
> exceptions pass around, and stop caring about it.  But somewhere I read
> that it may lead about less efficient code, so I'm wary about it.
The main benifit I see is, that as part of the signature every one sees
which exceptions can be raised - so it becomes part of the
documentation. But definetely making no specification is better than
making false promises. 
Most specifications in Tagcoll seems to be sound, but in
Debtags::Environment there should be better either no or correct 
specification.


> I fear that making that change now would break binary compatibility,
> though, so I'm adding that as a "first thing to do in the next
> creativity rush" note.  In the meantime, better solutions still have
> some time to try to show up.  GCC 2.4, unfortunately, still doesn't help
> here (or am I missing some switches?  javac does it, damnit!)
Well java enforces correct exception specifications as it is an error to
do otherwise. But this has also the drawback of blowing up trival code.

Greetings Ben