public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Daniel Gutson <daniel.gutson@tallertechnologies.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Martin Sebor <msebor@gmail.com>,
		Aurelio Remonda <aurelio.remonda@tallertechnologies.com>,
	"libstdc++" <libstdc++@gcc.gnu.org>,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	daniel.gutston@tallertechnologies.com
Subject: Re: [PATCH] Add configure flag for operator new (std::nothrow)
Date: Thu, 05 Nov 2015 15:22:00 -0000	[thread overview]
Message-ID: <CAF5HaEX5Ju0uXcFP4cLRvh_wWOBaqezbM6WdNUFp+CbzzKNjdg@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdQ_8cL8rqsX5u3NrNouf6E2_LtRPQ5F-V-rgTQ3FZTRug@mail.gmail.com>

On Wed, Nov 4, 2015 at 3:20 AM, Jonathan Wakely <jwakely.gcc@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

  parent reply	other threads:[~2015-11-05 15:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 12:35 Aurelio Remonda
2015-11-03 13:26 ` Paolo Carlini
2015-11-03 14:06   ` Aurelio Remonda
2015-11-03 14:12     ` Andreas Schwab
2015-11-03 17:17   ` Aurelio Remonda
2015-11-03 20:25 ` Martin Sebor
2015-11-03 20:41   ` Daniel Gutson
2015-11-03 21:10     ` Martin Sebor
2015-11-03 23:09       ` Mike Stump
2015-11-03 23:50         ` Martin Sebor
2015-11-04  8:07           ` Marc Glisse
2015-11-04  6:20     ` Jonathan Wakely
2015-11-04  6:32       ` Jonathan Wakely
2015-11-05 15:22       ` Daniel Gutson [this message]
2015-11-05 17:11         ` Jonathan Wakely
2015-11-05 18:01           ` Daniel Gutson
2015-11-06  1:56             ` Jonathan Wakely
     [not found]               ` <CAF5HaEVF12CH+Z6BssUwmS-TVxGsjfXWdvvGUZ2OHuUhOhhwHA@mail.gmail.com>
2015-11-06  4:24                 ` Jonathan Wakely
2015-11-06  7:19                   ` Marc Glisse
2015-11-06  9:59               ` Pedro Alves
2015-11-10 13:10                 ` Jonathan Wakely
2015-11-16 18:56                   ` Pedro Alves
2016-02-19 21:56                     ` Daniel Gutson
2016-02-22 15:58                       ` Jonathan Wakely
2016-02-19 21:45                   ` Daniel Gutson
2015-11-17 12:38         ` Sebastian Huber
2015-11-04  6:15   ` Jonathan Wakely
2015-11-04 14:52     ` Martin Sebor

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=CAF5HaEX5Ju0uXcFP4cLRvh_wWOBaqezbM6WdNUFp+CbzzKNjdg@mail.gmail.com \
    --to=daniel.gutson@tallertechnologies.com \
    --cc=aurelio.remonda@tallertechnologies.com \
    --cc=daniel.gutston@tallertechnologies.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=msebor@gmail.com \
    /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: link
Be 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).