220 34255 <CAFk2RUaAOnPnLsUc5SpycK9dTpeT60+Vt0dQFbSPMROb7JCf0w@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposal to add constructors to std::bad_alloc
 exception class.
Date: Fri, 1 Sep 2017 22:35:02 +0300
Lines: 39
Approved: news@gmane.org
Message-ID: <CAFk2RUaAOnPnLsUc5SpycK9dTpeT60+Vt0dQFbSPMROb7JCf0w@mail.gmail.com>
References: <d9001051-0946-4dcf-bf78-8bcdb8302989@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: blaine.gmane.org 1504294524 5547 195.159.176.226 (1 Sep 2017 19:35:24 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 1 Sep 2017 19:35:24 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC5JHI7A7ALRB2HMU3GQKGQE7KD4TJQ@isocpp.org Fri Sep 01 21:35:12 2017
Return-path: <std-proposals+bncBC5JHI7A7ALRB2HMU3GQKGQE7KD4TJQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f198.google.com ([209.85.223.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRB2HMU3GQKGQE7KD4TJQ@isocpp.org>)
	id 1dnriU-0000BY-N0
	for gclcip-std-proposals@m.gmane.org; Fri, 01 Sep 2017 21:34:58 +0200
Original-Received: by mail-io0-f198.google.com with SMTP id 87sf3555038ior.23
        for <gclcip-std-proposals@m.gmane.org>; Fri, 01 Sep 2017 12:35:05 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1504294505; cv=pass;
        d=google.com; s=arc-20160816;
        b=uFrUNR/2uOTPCt7B5gJuOyKFuoJJO50CsDvSX3qNfR9j5qP503b4q0AAqT0MBAA7aZ
         fbSwvvwzqhRs/+ifUcSsT/Hflx4yiIl5yERfVOCCV0LDLu+KIQZcYTBW0d7jcbTSLaAr
         4Iwt0ULEQhRruQsFcUwmzxzCWF3W9GKMKUC5boHkEtUvVHuUZHbFj9QIAzM4ca/6sE47
         ++kneuWe6yr7deazMiM1JViZx/xYkII7o2uNNHPaEVzOT2Dcr1YC3RnGEGKL9ZIlOfDR
         cR3EeAmbbE3sq6qLT4QfGyymMFRzVfEpSjNJIGWXAjeKXCiSPWhu6NI+1vse3Jm6ZSC8
         U/gQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=kY2QYLTwhVQD/LvX7cYCGBzjrPbb7UZSVgEEnqaXMTE=;
        b=Uo05p2XkEB1aHkqS1jKQ2jG+O6Byc0ZSvwXM1shA4/uxQRX+elHYFzdXYUft8dJcum
         g27OaxBX+lqF4Q5zLbPPPuLKjcFY67JrmrrI0mPvuPq7C7xOjhxPwIhW2peoWYkuONM0
         Er4crpaR8fgqibdOUNNAKpEYlY/kiI9DDzhzEcxfjgbp7V5GJ+2CsYf2EGDNCJPXVeyX
         idR1zicWWq86FwO5TBTJLe1zNn4ksZnX7IZRf8Bcrdkf2Ky4bBVLHybMK/RNACki+cxV
         N8CbBrRKbTGY8H9ywfyp7WAMX152zC3+5EM5EpvioWW9TvxqTnIeMsgtmm3GbNTcrCa6
         e8VQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=oX/mjjS0;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=kY2QYLTwhVQD/LvX7cYCGBzjrPbb7UZSVgEEnqaXMTE=;
        b=L8tPmNcb9SAXm5cBpP5dbCE69ZRA8WQ4XwDfJAyli3XB2xNZtu+jQXtvYdD6r681hI
         NAG8wPGq/50c70I27579wC0i0bU1HarFjIrPyghbNIvOY4s0YCTjmuj1y0DpI/Mw9AhU
         qF55wciyq+4iAIZMA9+vCYxe9nU7EB42Ahh99KRBvBz8YUk5Rmd7oGs1wRdNM10I0fq1
         neUhD6ApygvQ2TV8T4RMwJj9DxWpa+soTDl1kk7einp0BzVKqsvzg1B1InAmCO7Co18F
         wI3iSXAxGq2CGTeCAyxA8f3cz1qziS4zHcqWSwqRTuQtubTbe9pSr5LR6vNPgJWVP/u2
         b4WA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=kY2QYLTwhVQD/LvX7cYCGBzjrPbb7UZSVgEEnqaXMTE=;
        b=ja5CdogfEFojQLJHeJXMVEeX0X/o2tJbjm9qD59xB+zX6c5InbqihonTPvf3L8OgXU
         e4UFviTrR7HVgeoMOjyuK+rxrxnia+6K6oFfBjbAxSwH1E5n2ajhmAqmBk1FO24JQvjZ
         ixIrUAMuye7nOHkvqtzgCFII4i6H3Zk8mqyP0g+TxCH0CPWxynz4tT1HLZlyDhfDyhoJ
         3qZVxT661n7dFl5A+zNH84xop9+TxTaOi/ajxgh4ybPzDBLxOb5qrUMYZ3RGhLlNE173
         yolRc5CJlqEYh43KrdqIRRHue0KKh8rcEj0rT9fFVybtpUbcrnELzbDo2i5FKkss7CPL
         GMDg==
X-Gm-Message-State: AHPjjUjIYt0v0kFDaGS8atHr6EvPW57NX2h/8p9SJikMRQJY4FxOQfwK
	X23jNISPGCOzTp/N
X-Google-Smtp-Source: ADKCNb7th3ZwdPtXtpXysWpCgVP+BZX+n7aziS/JnYO456O3ussFvMmY9IfHtuxczLpXIEGJdEJ4Yw==
X-Received: by 10.107.57.136 with SMTP id g130mr5572326ioa.45.1504294505443;
        Fri, 01 Sep 2017 12:35:05 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.18.73 with SMTP id a70ls533405ioj.18.gmail; Fri, 01 Sep
 2017 12:35:04 -0700 (PDT)
X-Received: by 10.31.206.194 with SMTP id e185mr1835378vkg.0.1504294504167;
        Fri, 01 Sep 2017 12:35:04 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1504294504; cv=none;
        d=google.com; s=arc-20160816;
        b=K62mh0fnbAO8LHMaArwL8OLUW3b8rZjwGx1YzxLEYsFM/IUa8/uExOyXJquXQU4nci
         WarqOQ+hGCW8+oNS+CKDTk1lEXO78JenVQeYVxMySs+jqX8YoV/NfFYUP7GEeFfOI5yY
         GEZw3zaGXIy9KOz9jYR7bK9e/1bKu4EjqdNUnXYG8Mh6Ojh08PdJOvfqHc8UmFywWwy9
         TwcMgOHPFQpYZBNjkHIxieAQlo5RIv88DN9y2ZVtXFTDGVGexKe7CXdcbyt3MTsoLABy
         CQkY3EZYvy/Bfrjh+hp5VB3YC86T35gcF+f6GkLYRv1fyTkShg0HE4O1N692e5g/bOzR
         MuHQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=6a6eAI89dH0qPek6Oj3/X+8+WgJOeXlmsr25hwW64pY=;
        b=l/zro4eRLdWfmmC2D8CK1RzSMg0+ntPJsRsu73B0q9fUF/Mmbj+BjaVPDzg4hS0Yy6
         DWOU+PFM9xVwjatIgOEl+IRCBW3SKD/KkS3/dq+2WeQWEljuqDZrUbX3OeBLxJ1A2qGL
         GINRdoac7J53TjhxBzAfKyupl9r+cdmMCu9WL9zF+puGuNRqXaKdTXTjo0bvYFd5YAFG
         LDMux1kRxi8t0ZJZ/Kt6GOFJ0grKo9/omjcJxKHcw9wxgkz93rQJO9UH5vGUZIsafuCb
         ir9KwqUVkskLZKdFYLGtBxBPkeVvVN8f1rQbcMkQdIV4/8lF+f96kxbYkPp/BXfE9fM5
         OCpA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=oX/mjjS0;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id a27sor619367uaf.65.2017.09.01.12.35.04
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 01 Sep 2017 12:35:04 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.159.40.102 with SMTP id c93mr1815040uac.51.1504294502678;
 Fri, 01 Sep 2017 12:35:02 -0700 (PDT)
Original-Received: by 10.103.103.135 with HTTP; Fri, 1 Sep 2017 12:35:02 -0700 (PDT)
In-Reply-To: <d9001051-0946-4dcf-bf78-8bcdb8302989@isocpp.org>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=oX/mjjS0;       spf=pass
 (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41
 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:34255
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34255>

On 1 September 2017 at 22:28, Rich Sposato <rich.sposato@gmail.com> wrote:
> Hi,
>
> I wrote this proposal after discovering the std::bad_alloc exception class
> only has a default constructor. Other exception classes have constructors
> with a string parameter. The lack of a similar constructor in bad_alloc has
> caused problems for me.
>
> This is the second draft of this proposal. Please provide feedback on how to
> improve it before I submit it.
>
> I would especially prefer feedback on wording and style so that it conforms
> with the wording and style of accepted proposals. I would also like feedback
> on technical correctness.


I have a technical question. The proposed signatures look like
bad_alloc needs to store a copy of
the data passed as an argument for the constructor. How likely is
storing that copy to fail right
after an allocation failure?

I have a follow-up question: did you consider the alternative where
the caller of the new constructor must pass an rvalue reference
to a std::string, in which case there would be most likely a much
smaller allocation, as in the case of a dynamically
allocated string that doesn't fit into SSO, there would be none, and
in the SSO case, a very small allocation that
is not dynamic?

Another question I have is this: what sort of ABI impact will this
change have for existing standard library implementations?

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUaAOnPnLsUc5SpycK9dTpeT60%2BVt0dQFbSPMROb7JCf0w%40mail.gmail.com.

.
