On 5 November 2015 at 20:52, Daniel Gutson wrote: > 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.
Why can't that be done by replacing operator new with a user-defined function, instead of modifying the default one? A program that wants to make use of the altered semantics is non-portable because it relies on a custom libstdc++ configuration option, and has to install a custom new-handler that relies on the altered libstdc++ behaviour. Replacing operator new to do the logging is portable and requires no custom configuration. (I'm not rejecting the patch, but am still trying to make sure it's a useful change.)