[Debtags-devel] Exception issues in Debtags::Environment
Enrico Zini
zinie@cs.unibo.it
Sun, 5 Sep 2004 04:14:10 +0200
--7ZAtKRhVyVSsbBD2
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Sat, Sep 04, 2004 at 03:18:39PM +0200, Benjamin Mesing wrote:
> This calls _vocab.read() which might raise some exceptions but the
> function guaranties to raise no one, so in the result unexpected() will
> be called and the program will be terminated.=20
> I would strongly suggest to either catch the possible exceptions from
> _vocab.read() or add them to the signature of the
> Environment::vocabulary() and StandardEnvironment::loadVocabulary(). I
> would much prefer the latter case as else there would be no possiblity
> to get to know that something went wrong.
> I also suspect that there are other cases in the Environment class where
> the same problem might appear but I didn't take a closer look there.
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.
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 (wrong) approach I followed so far was to not care too much about
it, and fix things when unexpected shows them. This is bad, and it was
a way of leaving the problem open waiting for a better solution to come
out. Appearently it didn't come out to me so far, so I should really
consider just taking those throws away (with or without the colorful
italian curse).
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!)
Ciao,
Enrico
--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico@debian.org>
--7ZAtKRhVyVSsbBD2
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFBOnZy9LSwzHl+v6sRApyxAJ9+FhAitIvV0GEOlHw3rnAUvZHqcQCeNhVf
/Y4DhumC/GP7BQPgrwmTGfc=
=gfgW
-----END PGP SIGNATURE-----
--7ZAtKRhVyVSsbBD2--