Date: 2016-08-08 Project: Programming Language C++ Reply-To: Kamil Rojewski

A proposal for noexcept(auto) exception specification I.

Introduction

An automatic exception specification, noexcept(auto), is proposed as a means to improve exception safety, fix problems of testing noexcept code and lessen burden on programmers when writing sometimes convoluted noexcept expressions.

II. Motivation noexcept exception specification allows programmers to mark a function conditionally nonthrowing by allowing them to provide a boolean expression, enabling or disabling all exceptions. Unfortunately, it has some inherent problems: •

Complex condition expressions can be error prone and result in invalid exception specification. Also, the readability (and thus maintainability) of such code suffers.



noexcept functions are hard to test. This was discussed in N3248 when noexcept specifiers for the Standard Library were considered. Ultimately, conditional noexcepts have been (mostly) dropped due to their problems.



Expressions for noexcept must be constantly monitored along with code changes.

noexcept(auto) aims at solving those problems by marking functions as conditionally noexcept, based on their static analysis by the compiler.

III. Impact On the Standard Compilers today are already required to do an analysis on possible no-throwing guarantee. For example, an implicitly declared special member function is required to have an exception specification, which is based on its implicit definition (this is specified in detail in part 15.4.14 of the Standard). This proposal allows the programmer to directly involve this mechanism to deduce if a function can be marked noexcept, by declaring it as noexcept(auto). Thus, an extensions to part 15.4 of the Standard is required.

IV. Design Decisions This approach was specifically chosen to leverage existing mechanisms with minimal impact on the Standard. It also solves the long-unresolved problem described in N3248. Backwards compatibility is retained, and no changes to existing code are necessary.

V. Technical Specifications Additions to part 15.4 [except.spec] of the Standard (marked in green):

1. A function declaration lists exceptions that its function might directly or indirectly throw by using an exception-specification as a suffix of its declarator. exception-specification: dynamic-exception-specification noexcept-specification dynamic-exception-specification: throw ( type-id-listopt ) type-id-list: type-id ...opt type-id-list , type-id ...opt noexcept-specification: noexcept ( constant-expression ) noexcept(auto) noexcept

In a noexcept-specification, the constant-expression, if supplied, shall be a constant expression (5.19) that is contextually converted to bool (Clause 4). A noexcept-specification noexcept is equivalent to noexcept(true). A ( token that follows noexcept is part of the noexceptspecification and does not commence an initializer (8.5).

12. A function with no exception-specification, with an exception-specification of the form noexcept(constant-expression ) where the constant-expression yields false, or with an exceptionspecification of the form noexcept(auto) where any of the functions it directly invokes allows any exception, allows all exceptions. An exception-specification is non-throwing if it is of the form throw(), noexcept, noexcept(constant-expression ) where the constant-expression yields true, or noexcept(auto) where every function directly invoked allow no exceptions. A function with a nonthrowing exception-specification does not allow any exceptions. An exception-specification is not considered part of a function’s type.

VI. References Alisdair Meredith, John Lakos, 2011, noexcept Prevents Library Validation, N3248

A proposal for noexcept(auto) exception specification -

Aug 8, 2016 - Project: Programming Language C++. Reply-To: Kamil Rojewski ... for the Standard Library were considered. Ultimately ... the Standard). This proposal allows the programmer to directly involve this mechanism to deduce if a function can be marked noexcept, by declaring it as noexcept(auto). Thus, an ...

50KB Sizes 0 Downloads 162 Views

Recommend Documents

A Global Exception Fault Tolerance Model for MPI
Driven both by the anticipated hardware reliability con- straints for exascale systems, and the desire to use MPI in a broader application space, there is an ongoing effort to incorporate fault tolerance constructs into MPI. Several fault- tolerant m

Java-Inheritance, Interface & Exception
There is a special way to call the superclass's constructor. – There is ... BoxWeight weightbox = new BoxWeight(3, 5, 7, 8.37);. Box plainbox = new Box();.

Exception Handling for Service Component ...
languages, like Java, C++, and Ruby, and frameworks and environments, such as ..... In this application, a server receives requests from a client, processes them ...

Java-Inheritance, Interface & Exception
System.out.println(k);. } void sum() {. System.out.println(i+j+k);. } } class SimpleInheritance { public static void main(String args[]) {. A superOb = new A();. B subOb ...

A PROPOSAL FOR COMMUNITY DRIVEN AND ... - GitHub
Dec 4, 2012 - 1. INTRODUCTION. Astronomical catalogues and databases are almost as old as ... In recent years, the internet allowed the open source com- munity to make ..... and tools that the computer science and open source commu- nity uses. .... d

pre-proposal for finance wg guidelines for proposal -
OB will e recompensed between General Assemblies (GAs); and ... That the General Assembly (GA) authorize the FWG to open a checking account at WECU as ...

Request for Proposal - Ning
Sep 3, 2013 - Synopsis: Enhancing Mobile Populations' Access to HIV and AIDS Services, Information and. Support a 5 year project funded by Big Lottery ...

SASE-Submitting-a-Proposal
Log into your account at sase.org – green button “sign in” in the top right-hand corner of the homepage: ... Once you are logged in, you will see the green button “submit a paper” in the top right-hand corner of any page on the ... Conferen

request for proposal - AOS92
Feb 26, 2015 - In the event taxes are imposed on the services purchased, the District will not be responsible for payment of the taxes. The vendor shall absorb the taxes entirely. Upon request, the District's Tax Exempt Certificate will be furnished.

request for proposal - AOS92
Feb 26, 2015 - We are currently reducing the number of small printers in our inventory, so any proposal must be able to adjust based on future changes in printer inventory. The AOS92 computing environment consists of approximately 2,000 devices inclu

A Framework for Systematic Specification and E cient Verification of ...
then a description of an abstract level (such as the assembly language level), while its .... In section 6 we give veri cation benchmarks, and we last conclude.

A High-Level Protocol Specification Language for Industrial Security ...
Even assuming “perfect” cryptography, the design of security protocols is ..... has no access whatsoever; and channels which provide non-repudiation properties.

Request for Proposal - Care Nepal
Support a 5 year project funded by Big Lottery Fund, UK, is seeking a consultant / organization to produce a video documentary on role of EMPHASIS in ...

Specification - cs164
Fri. 2/3. Proposal. 2/6. Design Doc, Style Guide. 2/10. Beta. 2/24. Release ... or otherwise exposed) or lifting material from a book, website, or other ... Help is available throughout the week at http://help.cs164.net/, and we'll do our best to res

A Modest Proposal
already devoured most of the parents, seem to have the best title to the children. ... generally tough and lean, like that of our school-boys, by continual exercise, and ... work, and consequently pine away from want of nourishment, to a degree, that

A Modest Proposal
well of the public, as to have his statue set up for a preserver of the nation. .... as fast as can be reasonably expected. And as to the young .... rent without money or trade, the want of common sustenance, with neither house nor clothes to cover.

PROPOSAL FOR SOLAR PHOTOVOLTAIC ... - SORGENLOS.de
Dec 31, 2009 - 125 MWp Solar Photovoltaic Power Plant for Manav Sewa. Page 2 ... hand, steps are being taken to tap the renewable energy sources such as ...

Request for Proposal - Care Nepal
Synopsis: Enhancing Mobile Populations' Access to HIV and AIDS Services, Information ... Proven experience in making documentaries on development issues.

Request for Proposal
Nov 20, 2015 - Trade secrets and other proprietary data contained in proposals may be ..... The Town shall provide the bidder a reasonably secured storage space for .... Any bid containing a corporate bidder's certification to the statement of ...

a project proposal
of a Bachelor of Science (B.Sc Hons) degree in Computer Science and Engineering,. Obafemi Awolowo ... 4.4.2 The probability of dropping packet. 48 .... Over the past few years, researchers have come out with several congestion avoidance.

A Research Proposal -
To determine how advertisement exposure response functions differ between established brands and market newcomers. Submitted To. Prof Sanjeev Verma.

Specification - cs164
need a Mac for the course until Mon 3/19, but Xcode comes with iOS Simulator, which might prove handy for testing in the short term. If you do have a Mac, know ...

Specification - cs164
Computer Science 164: Mobile Software Engineering. Harvard College .... Log into your Bitbucket account and create a new, private repo as follows: □ Select ...