On Wed, Nov 4, 2015 at 3:20 AM, Jonathan Wakely <jwakely....@gmail.com> wrote: > On 4 November 2015 at 02:11, Daniel Gutson wrote: >> Since this is a nothrow new, we thought that probably the system >> might not be exceptions-friendly (such as certain embedded systems), >> so we wanted to provide the new_handler the ability to do something else >> other than trying to allocate memory and keep the function iterating. > > That could be done using an alternative overload of operator new > instead of altering the semantics of the standard one (that could be > provided as a GNU extension, for example). > >> In fact, our idea is that since the nothrow new can indeed return nullptr, >> let the new_handler do something else and leave the no-memory-consequence >> to the caller. >> This new flag enables just that. > > > The default configuration already allows the caller to deal with > allocation failure from the nothrow version of new, by not installing > a new-handler installed, and dealing with a null return value. How > would I use this alternative configuration? Since the behaviour only > changes when a new-handler is installed, presumably I'm meant to > install some kind of new-handler that does something else ... but > what? The patch should include documentation explaining when and how > to use this option.
Real use cases: statistics and logging. It's a (one time) callback reporting that something went wrong, but not intended to fix things e.g. by attempting to free more memory. -- Daniel F. Gutson Chief Engineering Officer, SPD San Lorenzo 47, 3rd Floor, Office 5 Córdoba, Argentina Phone: +54 351 4217888 / +54 351 4218211 Skype: dgutson LinkedIn: http://ar.linkedin.com/in/danielgutson