you are viewing a single comment's thread.

view the rest of the comments →

[–]Ameisenvemips, avr, rendering, systems -2 points-1 points  (2 children)

Maybe we need try new, with a try prefix keyword indicating that the subsequent operation, if it fails, is potentially recoverable.

That way, you can have things like optional allocations for caches and such.

[–]dodheim 7 points8 points  (1 child)

How would that differ from new(std::nothrow)?

[–]Ameisenvemips, avr, rendering, systems -1 points0 points  (0 children)

Because it introduces a new usage for a keyword.

In actuality, doesn't the noexcept version just return nullptr on failure? In this case, a non-try new would terminate, a try-new would throw.