On Wed, 06 Jun 2012 05:13:39 -0400, Lars T. Kyllingstad <pub...@kyllingen.net> wrote:

On Friday, 1 June 2012 at 12:29:27 UTC, Steven Schveighoffer wrote:
On Fri, 01 Jun 2012 04:48:27 -0400, Dmitry Olshansky <dmitry.o...@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).

With some sugar:

     auto a = nothrow new Foo; // Returns null on OOM

Then, ordinary new can be disallowed in nothrow code.

That doesn't work, new conflates memory allocation with construction. What if the constructor throws?

-Steve

Reply via email to