DMD 1.027 and 2.011 releases

Sean Kelly sean at invisibleduck.org
Tue Feb 26 16:47:00 PST 2008


== Quote from Graham St Jack (Graham.StJack at internode.on.net)'s article
> 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.

The nice thing about offering nothrow only is that it implicitly marks any unlabeled routine as one that
may throw an exception.  The problem in C++ with explicit exception specs is those unlabeled
routines--they can throw anything but they're also callable from nothrow routines because they might
not actually throw anything.  It's a mess.


Sean



More information about the Digitalmars-d-announce mailing list