From 4978970498542400622
X-Google-Thread: f78e5,1e6093a60facd084
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news1.google.com!news3.google.com!news.glorb.com!newsfeed0.kamp.net!newsfeed.kamp.net!newsfeed.stueberl.de!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: AlbertoBarbati@libero.it (Alberto Ganesh Barbati)
Newsgroups: comp.std.c++
Subject: Re: [Proposal] noreturn_t
Date: Mon, 23 Oct 2006 01:12:06 GMT
Organization: [Infostrada]
Lines: 46
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <TxU_g.13459$Fk1.31284@twister2.libero.it>
References: <1161490402.699940.293180@b28g2000cwb.googlegroups.com> <453C0E79.10002@erdani.org>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1161565950 5612 158.152.254.254 (23 Oct 2006 01:12:30 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 23 Oct 2006 01:12:30 +0000 (UTC)
X-Original-To: std-c++@mailman.ucar.edu
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla Thunderbird 1.5.0.7 (Windows/20060909)
X-Scanned: with antispam and antivirus automated system at libero.it
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 k9N1C6L1010602;
	Mon, 23 Oct 2006 11:12:06 +1000 (EST)
X-NNTP-Posting-Date: Mon, 23 Oct 2006 03:03:47 MET DST
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++:4188

Andrei Alexandrescu (See Website For Email) ha scritto:
> Andrei Polushin wrote:
>> I propose to add a special type, std::noreturn_t, to indicate that
>> function does never return.
>>
>> Actually, some compilers have the similar feature, known as either
>> __declspec(noreturn) or __attribute__ ((noreturn)), but it is used
>> primarily for optimization purposes and does not affect language.
> 
> There is precedent in the Cecil language as well (the "none" type).
> 
>> Throw expression should return std::noreturn_t instead of void, and
>> the type noreturn_t should be convertible to bool:
> 
> Actually the type noreturn_t should be convertible to any other type. 
> That makes it the bottom of the type hierarchy, where it belongs.

Why? IMHO it should behave like void, in the sense that it should not be 
convertible to any type (except, possibly, void itself) so that you 
cannot put it by mistake into an expression. I would also disallow the 
possibility to explicitly convert an expression to noreturn_t (something 
that you can do with void).

> I implemented and used such a type in existing C++, and found it 
> marginally useful. I personally don't think it's a compelling feature to 
> add to the language.

It was marginally useful because you implemented it in existing C++! The 
proposal is only meaningful if the compiler is able to exploit the added 
information for:

>>     - better compile-time control path analysis,
>>     - better runtime error checking syntax,
>>     - easier optimizable code,

BTW: I guess the OP meant to say "better *compile-time* error checking 
syntax" not runtime. There's no syntax checking happening at runtime...

Ganesh

---
[ 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                      ]



