This is the mail archive of the gcc@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]

Re: Extension for a throw-like C++ qualifier


On Mar 30, 2007, at 11:05 AM, Sergio Giro wrote:
int TheClass::exceptMethod() _throw TheException {
  throw TheException();
}

In this case, the gcc would check at runtime that the only exception
the method exceptMethod may throw is TheException.

It does.


Moreover

int TheClass::wrongMethod() _throw () {
  exceptMethod();
}

should yield an error,

It does, through, at runtime.


should correct, since the exception is catched.

It is.


I think that, if it is pessimistically supposed that every exception
not enclosed into a try { } catch { } block may be thrown, the check
can be done at runtime.

It is.


The overall idea is, of course, to give information to the caller
about the exceptions it must handle.

Right, exception specifications do.


I think that this extension would worth the while. Any ideas?

? Just what did you want that isn't in the standard again? Is the feature you want just static checking for exception specifications at compile time?



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