On 3/30/07, Mike Stump <[EMAIL PROTECTED]> wrote:
? 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?
Yes, it is. Please read "compile time" when it says "runtime". The errors mentioned are compile errors, not runtime errors. I don't know if it is exactly "static checking", because some programs yielding compile errors with this feature should not yield runtime errors without this feature. As an example, int TheClass::wrongMethod() _throw () { if(0) throw TheException(); } would yield a compile error, but using the standard throw does not generate a runtime error. In addition, I think that it is not convenient to perform the check as a feature for the existing throw. I think that it is convenient to create a new keyword (which I oh-so-cleverly named _throw) and allow such an extension for the language which something like -fallow_throw. Cheers, Sergio On 3/30/07, Mike Stump <[EMAIL PROTECTED]> wrote:
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?