DMD 1.027 and 2.011 releases

Graham St Jack Graham.StJack at internode.on.net
Tue Feb 26 16:35:46 PST 2008


On Mon, 25 Feb 2008 08:55:17 -0800, Walter Bright wrote:

> Graham St Jack wrote:
>> It will be a good trick if you can pull it off. I don't see how it can
>> be done without examining the source code of all the called functions,
>> leaving us back where we started with throw specs.
>> 
>> The C++ approach of a runtime check isn't perfect, but at least it can
>> be done, and provides a more definite form of documentation than
>> comments.
> 
> Are you sure it does a runtime check for nothrow?

g++ certainly does runtime checking. I'm sure it does no static checking 
at all.

We use the throw() and throw(list-of-exceptions) specs all the time in 
our C++ code, relying on the runtime checking to tell us if we get it 
wrong. This is quite horrible compared to static checking, but it is a 
lot better than nothing, because we find out what exception was thrown 
and which throw-spec was violated.

The vast majority of functions in our C++ code use an empty throw-spec, 
so if D had nothrow with some static checking plus a runtime check, I 
would be better off than I am now with C++. Of course I would be even 
better off if the static checking was complete, but that seems to be too 
tricky.


> 
>> If the static checks aren't done well enough and runtime checks aren't
>> done at all, I would prefer to rely on comments.



More information about the Digitalmars-d-announce mailing list