220 17242 <3c0b30ba-2947-46cf-82b9-7971bf0d267b@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vittorio Romeo <vittorio.romeo.vee@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: noexcept(auto)
Date: Sat, 4 Apr 2015 13:07:36 -0700 (PDT)
Lines: 205
Approved: news@gmane.org
Message-ID: <3c0b30ba-2947-46cf-82b9-7971bf0d267b@isocpp.org>
References: <1657285.u9ziYB6mWs@tjmaciei-mobl4> <273de67b-0d68-42b9-ab94-c69f3f53da79@isocpp.org>
 <12209035.xqONZKyqh9@tjmaciei-mobl4>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1533_1373248836.1428178056317"
X-Trace: ger.gmane.org 1428178065 29506 80.91.229.3 (4 Apr 2015 20:07:45 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 4 Apr 2015 20:07:45 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCO3NDEYZQHRBCMJQGUQKGQEW2XAKWY@isocpp.org Sat Apr 04 22:07:40 2015
Return-path: <std-proposals+bncBCO3NDEYZQHRBCMJQGUQKGQEW2XAKWY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f197.google.com ([209.85.160.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCO3NDEYZQHRBCMJQGUQKGQEW2XAKWY@isocpp.org>)
	id 1YeULz-00039Y-3r
	for gclcip-std-proposals@m.gmane.org; Sat, 04 Apr 2015 22:07:39 +0200
Original-Received: by ykft189 with SMTP id t189sf1595494ykf.0
        for <gclcip-std-proposals@m.gmane.org>; Sat, 04 Apr 2015 13:07:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :content-type:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=YPoU7SzPFrqHghIJ6UuaQ6Yz677/A3ikENFYXNkXrwk=;
        b=Z1g23ix/G/zlBbU/R0sKUi5r1io8ROXHcKjJHM7/mTYFZGSeE8N3ZgQuxz6UflfS74
         gQ9BFlmlMD0oxLNECFXhAM3rUX/bNYyOFAOj7iwGlGbbLMxlNJrxzRwzAU9S3+p/0atT
         dg+SomkHt917oMAqrw9EEGbGRkuqvPRl9PuyaA6JP9zyPrzLFdlzf30/gL1fQgklA6m3
         rC+A5ZBRs/U1LhaO4TPB8tVqetSSbfB206qtER4Gdyo40hj5wEZ8XZkkIKobKnttDyjO
         GptNRCUBcBeZpKtp93aMm9BMXjpI/talepgsTGE83R3sDQx1/wIS+rMESnDpIDrARyfw
         /syw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:content-type:x-original-sender:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=YPoU7SzPFrqHghIJ6UuaQ6Yz677/A3ikENFYXNkXrwk=;
        b=GZuGiICQwH2gzEN4R5tZgo17jiqro64N/raB730um+Gok4dtzEukCw2cX0HkiesnvR
         7CZGpfoqjrQEytDzRk/HMbWXPBNaVS0qklgTqSpa512RbrWW/byWl+hIAcxDBIsuQniI
         DyKb5oG1qIZoJEpyKPUXCy0hgdOJqD85dZEjWhO2NXcpP6rBuNlgjJG/zZuds5rA/VIj
         daFAn12KBwHzJj6aLKQRntZBsdIOR36X56H9ry/VGX7U8rWT0NCcqwFDPyd3xggCEq+B
         a2K8ha8q23YlE9qFImeTSjPFZXAxEmw5Z3ALVQuWZh+qkJIhCnjrFLyvDqcERLg8+zwg
         ojNQ==
X-Gm-Message-State: ALoCoQn1WgkCPMLMcGeTMHi00dP1DSa1rif4ThDPFRseakS5vuUSmRPJPE+fooiBWL8eccYnia3Y
X-Received: by 10.52.170.129 with SMTP id am1mr9515919vdc.1.1428178057776;
        Sat, 04 Apr 2015 13:07:37 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.40.41 with SMTP id w38ls1686507qgw.85.gmail; Sat, 04 Apr
 2015 13:07:37 -0700 (PDT)
X-Received: by 10.140.101.148 with SMTP id u20mr97605qge.5.1428178057064;
        Sat, 04 Apr 2015 13:07:37 -0700 (PDT)
In-Reply-To: <12209035.xqONZKyqh9@tjmaciei-mobl4>
X-Original-Sender: vittorio.romeo.vee@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:17242
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/17242>

------=_Part_1533_1373248836.1428178056317
Content-Type: multipart/alternative; 
	boundary="----=_Part_1534_1186432343.1428178056318"

------=_Part_1534_1186432343.1428178056318
Content-Type: text/plain; charset=UTF-8

I didn't strive for correctness, just wanted to make a simple example :)
In a real-life implementation even `~int()`, `~SomeClass()` and 
`~decltype(a + b)` have to be checked for noexcept compliancy.
(...and probably some more stuff that I'm missing now.)

On Saturday, 4 April 2015 21:55:03 UTC+2, Thiago Macieira wrote:
>
> On Saturday 04 April 2015 12:31:51 Vittorio Romeo wrote: 
> > I definitely have a lot of occurrences in my code where I repeat the 
> body 
> > of small functions in the noexcept qualifier. 
> > Something like this would help a lot. 
> > 
> > Would there be any issue in expanding this feature proposal to 
> non-one-line 
> > functions? 
> > 
> > Wouldn't the compiler be able to convert something like: 
> > 
> > void func() noexcept(auto) 
> > { 
> >     int a; 
> >     SomeClass b; 
> >     auto c = b + a; 
> >     std::cout << c; 
> > } 
> > 
> > to 
> > 
> > void func() noexcept 
> > ( 
> >     noexcept(int{}) && 
> >     noexcept(SomeClass{}) && 
> >     noexcept(b + a) && 
> >     noexcept(std::cout << c) 
> > ) 
> > { 
> >     int a; 
> >     SomeClass b; 
> >     auto c = b + a; 
> >     std::cout << c; 
> > } 
> > 
> > ? 
>
> I don't see why not. And it's probably better than what you wrote, since 
> you 
> probably forgot the c assignment: 
>         noexcept(decltype(SomeClass{} + int{}) = decltype(SomeClass{} + 
> int{})) 
>
> It would also allow you to verify whether your code is really noexcept or 
> not 
> like you meant it to be: 
>
> void func() noexcept; 
> void func() noexcept(auto) 
> { 
>     int a; 
>     SomeClass b; 
>     auto c = b + a; 
>     std::cout << c; 
> } 
>
> Since all declarations of the same function need to have the same noexcept 
> specifier, the compiler needs to provide a diagnostic if the auto case 
> expands 
> to a different result from the other declaration. 
>
> -- 
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org 
>    Software Architect - Intel Open Source Technology Center 
>       PGP/GPG: 0x6EF45358; fingerprint: 
>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358 
>
>

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1534_1186432343.1428178056318
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I didn't strive for correctness, just wanted to make a sim=
ple example :)<br>In a real-life implementation even `~int()`, `~SomeClass(=
)` and `~decltype(a + b)` have to be checked for noexcept compliancy.<br>(.=
...and probably some more stuff that I'm missing now.)<br><br>On Saturday, 4=
 April 2015 21:55:03 UTC+2, Thiago Macieira  wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid=
;padding-left: 1ex;">On Saturday 04 April 2015 12:31:51 Vittorio Romeo wrot=
e:
<br>&gt; I definitely have a lot of occurrences in my code where I repeat t=
he body
<br>&gt; of small functions in the noexcept qualifier.
<br>&gt; Something like this would help a lot.
<br>&gt;=20
<br>&gt; Would there be any issue in expanding this feature proposal to non=
-one-line
<br>&gt; functions?
<br>&gt;=20
<br>&gt; Wouldn't the compiler be able to convert something like:
<br>&gt;=20
<br>&gt; void func() noexcept(auto)
<br>&gt; {
<br>&gt; &nbsp; &nbsp; int a;
<br>&gt; &nbsp; &nbsp; SomeClass b;
<br>&gt; &nbsp; &nbsp; auto c =3D b + a;
<br>&gt; &nbsp; &nbsp; std::cout &lt;&lt; c;
<br>&gt; }
<br>&gt;=20
<br>&gt; to
<br>&gt;=20
<br>&gt; void func() noexcept
<br>&gt; (
<br>&gt; &nbsp; &nbsp; noexcept(int{}) &amp;&amp;
<br>&gt; &nbsp; &nbsp; noexcept(SomeClass{}) &amp;&amp;
<br>&gt; &nbsp; &nbsp; noexcept(b + a) &amp;&amp;
<br>&gt; &nbsp; &nbsp; noexcept(std::cout &lt;&lt; c)
<br>&gt; )
<br>&gt; {
<br>&gt; &nbsp; &nbsp; int a;
<br>&gt; &nbsp; &nbsp; SomeClass b;
<br>&gt; &nbsp; &nbsp; auto c =3D b + a;
<br>&gt; &nbsp; &nbsp; std::cout &lt;&lt; c;
<br>&gt; }
<br>&gt;=20
<br>&gt; ?
<br>
<br>I don't see why not. And it's probably better than what you wrote, sinc=
e you=20
<br>probably forgot the c assignment:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;noexcept(decltype(<wbr>=
SomeClass{} + int{}) =3D decltype(SomeClass{} + int{}))
<br>
<br>It would also allow you to verify whether your code is really noexcept =
or not=20
<br>like you meant it to be:
<br>
<br>void func() noexcept;
<br>void func() noexcept(auto)
<br>{
<br>&nbsp; &nbsp; int a;
<br>&nbsp; &nbsp; SomeClass b;
<br>&nbsp; &nbsp; auto c =3D b + a;
<br>&nbsp; &nbsp; std::cout &lt;&lt; c;
<br>}
<br>
<br>Since all declarations of the same function need to have the same noexc=
ept=20
<br>specifier, the compiler needs to provide a diagnostic if the auto case =
expands=20
<br>to a different result from the other declaration.
<br>
<br>--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=
=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.=
com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQjCNE=
swDUBNCNanbu7euhqLn_62FW8ag';return true;" onclick=3D"this.href=3D'http://w=
ww.google.com/url?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg=
\75AFQjCNEswDUBNCNanbu7euhqLn_62FW8ag';return true;">macieira.info</a> - th=
iago (AT) <a href=3D"http://kde.org" target=3D"_blank" rel=3D"nofollow" onm=
ousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fkde.org=
\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA';return tr=
ue;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fkde=
..org\46sa\75D\46sntz\0751\46usg\75AFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA';retur=
n true;">kde.org</a>
<br>&nbsp; &nbsp;Software Architect - Intel Open Source Technology Center
<br>&nbsp; &nbsp; &nbsp; PGP/GPG: 0x6EF45358; fingerprint:
<br>&nbsp; &nbsp; &nbsp; E067 918B B660 DBD1 105C &nbsp;966C 33F5 F005 6EF4=
 5358
<br>
<br></blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1534_1186432343.1428178056318--
------=_Part_1533_1373248836.1428178056317--

.
