This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Check of throw qualifiers
- From: "Sergio Giro" <sergio dot giro dot ar at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 29 Mar 2007 22:25:17 -0300
- Subject: Check of throw qualifiers
Dear,
I would like to know if there are unimplemented checks related to
throw qualifiers. E.g., if I have two methods
int theClass::oneMethod() throw (AnException) {
throw AnException();
return 1;
}
int theClass::otherMethod () throw () {
return oneMethod();
}
Should this be an error? gcc does not complain about that.
In addition, if I use the method this way
try {
otherMethod()
} catch(AnException);
the exception is not catched (because of the "throw ()", I guess).
This seems to be quite strange, I think that the idea of using throw
qualifiers is to enforce that the only exceptions the caller needs to
catch are those declared in the qualifier. So, the "throw ()" should
not be possible. I think that the throw () should be possible only if
all the invocations to methods throwing exceptions are enclosed into
try { } catch blocks.
Quoting the manual, is it a "Regrettable thing we can't change" or a
"Known problem"?
Cheers,
Sergio