This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Checking exception specifications
- To: <egcs at cygnus dot com>
- Subject: Re: Checking exception specifications
- From: "Ross Smith" <ross dot s at ihug dot co dot nz>
- Date: Tue, 11 Aug 1998 12:15:53 +1200
From: Mike Stump <mrs@wrs.com>
>> To: egcs@cygnus.com
>> Date: Mon, 10 Aug 1998 12:00:51 +0200 (CES)
>> From: Sebastian Ritterbusch <uabp@rz.uni-karlsruhe.de>
>
>> Is there any way to let the compiler check if the specifications
>> are correct?
>
>Nope, not yet. It would be a quality of implementation warning type
>thing. We could add one, just I fear it would have oddles of false
>positives.
I agree. Consider this sort of thing:
double fourth_root(double x) throw (DomainError) {
if (x < 0.0) throw DomainError();
return std::sqrt(std::sqrt(x));
}
double fourth_root_of_absolute_value(double x) throw () {
return fourth_root(std::abs(x));
}
A compiler that checks exception specifications will give a false
warning for the second function, unless it's amazingly smart about
analysis.
--
Ross Smith ................................... mailto:ross.s@ihug.co.nz
.............. The Internet Group, Auckland, New Zealand ..............
"Remember when we told you there was no future? Well, this is it."
-- Blank Reg