Checking exception specifications
Ross Smith
ross.s@ihug.co.nz
Mon Aug 10 17:15:00 GMT 1998
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
More information about the Gcc
mailing list