https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56126
--- Comment #10 from Olaf van der Spek <olafvdspek at gmail dot com> --- On Tue, Jan 6, 2015 at 2:22 PM, bruck.michael at googlemail dot com <gcc-bugzi...@gcc.gnu.org> wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56126 > > --- Comment #9 from Michael Bruck <bruck.michael at googlemail dot com> --- >> Jonathan: Using -fno-exceptions says "I do not want ISO C++" so quoting the >> standard isn't very relevant. >> Olaf: No, as you could (should?) abort/terminate instead of returning NULL. > > I quoted it to illustrate that returning NULL is the intuitive option here, > while abort() is a completely new approach. Returning NULL is what I would > expect to be the case when -fno-exceptions is active and it is what happens in > the libc++ implementation AFAIK. -fno-exceptions transforms throws into aborts in the STL. Unfortunately it doesn't do that for other code but I've filed a feature request for to fix that. Given this transformation aborting would be the natural consequence. What does the GCC STL do? >> Why would you want an operator new that can't throw but is declared to >> potentially throw? > > Because -fno-exceptions suggests to the user that they can produce safe code > without using any exception-specific C++ syntax. I think we disagree on that part. BTW, what's your use case? Do you really want to check NULL on every call to new? Olaf