220 16803 <54F94414.10909@gmail.com> article
Path: news.gmane.org!not-for-mail
From: Pavel Kretov <firegurafiku@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Optimizing shutdown time by disabling global destructors
Date: Fri, 06 Mar 2015 09:07:16 +0300
Lines: 58
Approved: news@gmane.org
Message-ID: <54F94414.10909@gmail.com>
References: <2205e402-724e-4415-a738-66a04c40f7c7@isocpp.org> <CAEWLpty0gByW6k64XQd3bJQDLYHC3kfAXGZbUmNS7MFzR2A=sQ@mail.gmail.com> <54F8653E.2050004@gmail.com> <768f81bc-027e-451a-968e-9f07f544882a@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1425622054 5439 80.91.229.3 (6 Mar 2015 06:07:34 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 6 Mar 2015 06:07:34 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCKZ764MQENRBGMI4WTQKGQE4I7D2EQ@isocpp.org Fri Mar 06 07:07:30 2015
Return-path: <std-proposals+bncBCKZ764MQENRBGMI4WTQKGQE4I7D2EQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f198.google.com ([209.85.212.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCKZ764MQENRBGMI4WTQKGQE4I7D2EQ@isocpp.org>)
	id 1YTlPy-0004tx-JL
	for gclcip-std-proposals@m.gmane.org; Fri, 06 Mar 2015 07:07:26 +0100
Original-Received: by wivz2 with SMTP id z2sf243119wiv.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 05 Mar 2015 22:07:26 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to:content-type
         :content-transfer-encoding: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=N81pNlK8XgE/yIk8cBNuQ0ApbPABXDTiDGOVwY1cJTM=;
        b=iz+4WS5V3aKFO/MEId4rai8Wpx5jwhjPqB+gXmH3RIUkrrjlwuK9hYphnDZmM5dJjb
         hL9EE0gkTTkWGg9ufDFFR4TDs1WEgnfKjYRxVpOGOMfx7QZBOtMPrNuU2Wfeu2OFv5VS
         j2JSqudXFcVH1wLRlOzugt1myXRapdGjGYkdZY1+5pxi4LVcJa+mcJgq+0tmKOxMYMC4
         BDOyBlKffgyur78pIMBB3hit2qDhtyw6bO5EvysBQlyMELpyVVTnl+PNxRRZVX35Az/P
         gLghdDqqNuFWnACiCcjSsGzTHlum/FY2FPu8yp5UJ8hHFjSywajNZRD7z3XLbbReSqIT
   
X-Gm-Message-State: ALoCoQk0HA3zl3wxXjlzRe40Qseleyj+CxuoZM+rTZBTn/lS2tuVQ+SwF1GYjajuh6Qxmvik713s
X-Received: by 10.180.182.81 with SMTP id ec17mr2486474wic.0.1425622046040;
        Thu, 05 Mar 2015 22:07:26 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.8.134 with SMTP id r6ls40626laa.59.gmail; Thu, 05 Mar 2015
 22:07:20 -0800 (PST)
X-Received: by 10.112.154.234 with SMTP id vr10mr10954556lbb.115.1425622040874;
        Thu, 05 Mar 2015 22:07:20 -0800 (PST)
Original-Received: from mail-lb0-x231.google.com (mail-lb0-x231.google.com. [2a00:1450:4010:c04::231])
        by mx.google.com with ESMTPS id wh2si3035415lbb.41.2015.03.05.22.07.20
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 05 Mar 2015 22:07:20 -0800 (PST)
Received-SPF: pass (google.com: domain of firegurafiku@gmail.com designates 2a00:1450:4010:c04::231 as permitted sender) client-ip=2a00:1450:4010:c04::231;
Original-Received: by lbdu10 with SMTP id u10so8692600lbd.4
        for <std-proposals@isocpp.org>; Thu, 05 Mar 2015 22:07:20 -0800 (PST)
X-Received: by 10.112.85.165 with SMTP id i5mr11505899lbz.7.1425622040300;
        Thu, 05 Mar 2015 22:07:20 -0800 (PST)
Original-Received: from [192.168.1.215] (129.160.219.91.infosys.su. [91.219.160.129])
        by mx.google.com with ESMTPSA id dk5sm1612206lad.41.2015.03.05.22.07.17
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 05 Mar 2015 22:07:19 -0800 (PST)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
In-Reply-To: <768f81bc-027e-451a-968e-9f07f544882a@isocpp.org>
X-Original-Sender: firegurafiku@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of firegurafiku@gmail.com designates 2a00:1450:4010:c04::231 as
 permitted sender) smtp.mail=firegurafiku@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:16803
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/16803>


> It can break program correctness if you are relying on nodestroy for
> correct global destruction order. If the attribute is optional, the featu=
re
> cannot be used for this purpose.

User must not rely on an attribute as well as, for example, they cannot=20
rely on an "inline" keyword. User must treat your [[nodestroy]] the same=20
way and write their code to be correct regardless of it.

> The only difference you're adding here is you're specifying nodestroy as =
an
> attribute of a type instead of a variable.

That is a huge difference. Suppose you've marked an variable with the=20
attribute, like that:

     Application [[nodestroy]] application;

This object can internally hold a whole hierarchy of pointers to other=20
objects (forms, widgets, images loaded into memory), and some of them=20
may probably REALLY need non-trivial destruction (for example, a file=20
stream implicitly created deeply inside the GUI framework's internal=20
objects). User cannot be sure if it is safe for him to use [[nodestroy]]=20
on that variable. Moreover, destructors can also be virtual and user=20
cannot be sure if any possible subclass is safe to skip destructor.

So, [[nodestroy]] attribute on variable is more dangerous when it=20
erroneously used, then it is ignored by the compiler. Sticking it to=20
class declaration may serve as a hint for the compiler do solve the=20
problem by itself in the most sane way.

Also, you can achieve the desired effect already without having to=20
introduce any changes to the standard. Like that:

     class Singleton {
         static Singleton& get() {
             // NB: Memory leak here is intentional and okay.
             //     Dear maintainer, don't kill me plz.
             static Singleton* s =3D new Singleton();
             return *s;
         }
     };


=E2=80=94=E2=80=94=E2=80=94 Pavel Kretov.

--=20

---=20
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 e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.
