This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]