From 870640093501462725
X-Google-Thread: f78e5,1e6093a60facd084
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,UTF8
Path: g2news2.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: tommi.hoynalanmaa@iki.fi (=?UTF-8?B?VG9tbWkgSMO2eW7DpGzDpG5tYWE=?=)
Newsgroups: comp.std.c++
Subject: Re: [Proposal] noreturn_t
Date: Sun,  5 Nov 2006 00:51:33 GMT
Organization: Saunalahti Customer
Lines: 53
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <zA63h.45427$QF5.4075@reader1.news.jippii.net>
References: <1161490402.699940.293180@b28g2000cwb.googlegroups.com> <QuO0h.40384$V%7.8695@reader1.news.jippii.net> <4544215C.4020102@erdani.org>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1162688981 13509 158.152.254.254 (5 Nov 2006 01:09:41 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Sun, 5 Nov 2006 01:09:41 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Thunderbird 1.5.0.7 (X11/20060922)
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.csse.unimelb.edu.au id kA519agh015691
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.csse.unimelb.edu.au (8.13.6+Sun/8.13.6/Submit) id kA50pXJ9012619;
	Sun, 5 Nov 2006 11:51:33 +1100 (EST)
X-NNTP-Posting-Date: Sat, 04 Nov 2006 22:18:39 EET
X-Delivered-To: std-c++@mailman.ucar.edu
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news2.google.com comp.std.c++:4335

Andrei Alexandrescu (See Website For Email) kirjoitti:
> Tommi H=C3=B6yn=C3=A4l=C3=A4nmaa wrote:
>> This is a question about the execution flow and not about the result=20
>> type of a function. There would be no values whose type is noreturn_t.
>> So "noreturn" should be an attribute of a function like the throw=20
>> specifications.
>=20
> The point of the idea was different. Yes, values of that type cannot=20
> exist, but the properties of the static type control the expressiveness=
=20
> of the idioms in which the type could take part. And precisely because=20
> values of that "none" type can never exist, there is considerable stati=
c=20
> freedom with regard to the static properties of that type, which confer=
s=20
> it remarkable expressiveness.

But isn't "none" roughly equivalent to the void result type in C++?
Function that returns nothing has also a result type that contains no=20
values. Or does it have some other result type? I think this type should=20
also be at the bottom of the type hierarchy.

>> There could be another attribute "mustreturn" to indicate that a=20
>> function has to return. "mustreturn" and "noreturn" would be mutually=20
>> exclusive.
>=20
> I guess mustreturn is simply a static incarnation of the nothrow idea.=20
> Things get tricky when we start thinking of mustreturn as a guarantee=20
> that the function doesn't enter infinite loops - it wouldn't generally=20
> be quite possible to demonstrate that a function violates that=20
> assumption :o).

We could define "mustreturn" e.g. so that
1) A "mustreturn" function may call only other "mustreturn" functions
or
2) A "mustreturn" function may not call any "noreturn" functions.
Infinite loops and things like that would not be considered at all.
The semantics of "mustreturn" would be a bit unclear this way because it=20
would be possible that a "mustreturn" function executes an infinite time.

However, it may be that "mustreturn" is not worth implementing.

--=20
Tommi H=C3=B6yn=C3=A4l=C3=A4nmaa
s=C3=A4hk=C3=B6posti / e-mail: tommi.hoynalanmaa@iki.fi
kotisivu / homepage: http://www.iki.fi/tohoyn/

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



