runtime hook for Crash on Error
Steven Schveighoffer
schveiguy at yahoo.com
Fri Jun 1 05:29:26 PDT 2012
On Fri, 01 Jun 2012 04:48:27 -0400, Dmitry Olshansky
<dmitry.olsh at gmail.com> wrote:
> I don't agree that OutOfMemory is critical:
> --> make it an exception ?
No. What we need is a non-throwing version of malloc that returns NULL.
(throwing version can wrap this). If you want to throw an exception, then
throw it there (or use enforce).
Then you call that when you are using it in a recoverable way.
OutOfMemory is critical if you did not write code to handle it. It's
impossible for the compiler to know this, since it has no idea if the
error will be caught. A vast majority of code does *not* recover from out
of memory, so the default should be, throw an error.
-Steve
More information about the Digitalmars-d
mailing list