This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Checking exception specifications
- To: ross dot s at ihug dot co dot nz (Ross Smith)
- Subject: Re: Checking exception specifications
- From: Sebastian Ritterbusch <uabp at rz dot uni-karlsruhe dot de>
- Date: Wed, 12 Aug 1998 10:05:30 +0200 (CES)
- Cc: egcs at cygnus dot com
According to Ross Smith:
> I agree. Consider this sort of thing:
> ...
Like this? (In a different context)
#include <iostream>
class complex
{
private: double re,im;
friend double & Real(complex &a) { return a.re; }
friend double & Imag(complex &a) { return a.im; }
};
std::ostream & operator <<(std::ostream &o,const complex &a)
{ // Or another "User"-written function
return o << Real(a) << '+' << Imag(a) << 'i';
// If the compiler isn't _very_ smart ;), this will result
// in a warning although a isn't changed.
}
Okay, there are several ways to get around this but in my opinion is warning
about "const" the same thing as warning about possibly unhandled exceptions.
If you are serious about exceptions you will agree.
The problem is that if there is any unhandled exception and it occurs then
the program terminates. (And up to now there is _no_ way preventing this.)
But currently other things are more important than this, although
implementing this warning probably wouldn't be too difficult, but correcting
the header-files that use exception specifications.. ;)
I will try to find a way to check them on my own until it will be
implemented. I knew i was too early... ;)
Ciao, Sebastian.