DIP33: A standard exception hierarchy

Jonathan M Davis jmdavisProg at gmx.com
Mon Apr 1 13:30:06 PDT 2013


On Monday, April 01, 2013 21:17:27 Lars T. Kyllingstad wrote:
> On Monday, 1 April 2013 at 12:12:56 UTC, Lars T. Kyllingstad
> 
> wrote:
> > I think OutOfMemory should not be restricted by nothrow, and I
> > propose to solve it as described above.
> 
> More precisely: In principle, I think OutOfMemory *should* be
> restricted by nothrow, but it would break too much code, and be
> far too annoying, to be feasible. :)

There's really no point in making it so that OutOfMemory prevents nothrow, as 
it's pretty much assumed by the runtime that OutOfMemory means that you're 
toast (hence why it's not an Exception). If anything making it prevent nothrow 
would be a disaster, rendering nothrow nigh on unusable in many situations 
where it should work just fine. The whole point of nothrow is to indicate that 
no Exceptions can be thrown (and therefore anything that's required by 
exceptions doesn't have to be done). Errors don't fall in that category at 
all, especially in light of the fact that there's no guarantee that any clean-
up will be done when a non-Exception is thrown.

- Jonathan M Davis


More information about the Digitalmars-d mailing list