public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "olafvdspek at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56126] -fno-exceptions should activate -fcheck-new or issue diagnostic for all new operators without throw() Date: Wed, 07 Jan 2015 00:26:00 -0000 [thread overview] Message-ID: <bug-56126-4-DuULrivqv5@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-56126-4@http.gcc.gnu.org/bugzilla/> 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-bugzilla@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
next prev parent reply other threads:[~2015-01-07 0:26 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-01-28 4:49 [Bug c++/56126] New: -fno-exceptions produces constructors that rely on exceptions to signal errors in operator new bruck.michael at googlemail dot com 2013-01-28 4:55 ` [Bug c++/56126] " pinskia at gcc dot gnu.org 2013-01-28 5:13 ` bruck.michael at googlemail dot com 2013-01-28 5:26 ` [Bug c++/56126] -fno-exceptions should activate -fcheck-new or issue diagnostic for all new operators without throw() bruck.michael at googlemail dot com 2015-01-03 18:11 ` olafvdspek at gmail dot com 2015-01-04 1:54 ` bruck.michael at googlemail dot com 2015-01-04 13:29 ` redi at gcc dot gnu.org 2015-01-04 13:43 ` redi at gcc dot gnu.org 2015-01-04 15:50 ` olafvdspek at gmail dot com 2015-01-06 13:22 ` bruck.michael at googlemail dot com 2015-01-07 0:26 ` olafvdspek at gmail dot com [this message] 2015-01-08 21:20 ` bruck.michael at googlemail dot com 2015-01-08 21:22 ` olafvdspek at gmail dot com 2015-01-09 0:46 ` redi at gcc dot gnu.org 2015-01-09 8:24 ` bruck.michael at googlemail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-56126-4-DuULrivqv5@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).