November 2014

N4340: Remove Deprecated Use of the register Keyword -- Alisdair Meredith

New WG21 papers are available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4340

Date: 2014-11-26

Remove Deprecated Use of the register Keyword

by Alisdair Meredith

Excerpt:

The register keyword was deprecated in the 2011 C++ standard, as its effect was already implicit in the language. It remains reserved for future use by the standard, and is time to remove its vestigial specification.

Post-Urbana mailing available

The post-Urbana mailing of new standards papers is now available.

NOTE: A number of these papers have already been publicized on this blog. This is the complete list including ones not previously publicized.

WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup Disposition
2014-11-post-Urbana
N4250 WG21 2014-10-24 Telecon Minutes Jonathan Wakely 2014-10-27 2014-11      
N4251 WG21 2014-11 Urbana Minutes Jonathan Wakely 2014-11-21 2014-11      
N4252 PL22.16 2014-11 Urbana Minutes Jonathan Wakely 2014-11-21 2014-11      
N4253 Language Support for Runtime Contract Validation (Revision 9) J. Lakos, A. Zakharov, A. Beels, N. Myers 2014-11-21 2014-11 N4135 Evolution  
N4254 User-defined Literals for size_t and ptrdiff_t Rein Halbersma 2014-11-21 2014-11   Library Evolution  
N4255 Proposed resolution for US104: Allocator-aware regular expressions (rev 3) Mike Spertus 2014-11-03 2014-11 N3254 Library  
N4256 Concurrency TS Working Draft Artur Laksberg   missing N4107 Concurrency  
N4257 Delimited iterators (rev 4) Mike Spertus, Nathan Wilson 2014-11-04 2014-11 N4066 Library Evolution Adopted 2014-11
N4258 Cleaning up noexcept in the Library (Rev 3) Nicolai Josuttis 2014-11-07 2014-11 N4227 Library Adopted 2014-11
N4259 Wording for std::uncaught_exceptions Herb Sutter 2014-11-06 2014-11   Library Adopted 2014-11
N4260 Wording for Atomic Smart Pointers Herb Sutter 2014-11-08 2014-11   Library  
N4261 Proposed resolution for Core Issue 330: Qualification conversions and pointers to arrays of pointers Jens Maurer 2014-11-06 2014-11 N4178 Core Adopted 2014-11
N4262 Wording for Forwarding References Herb Sutter 2014-11-05 2014-11   Core Adopted 2014-11
N4263 Toward a concept-enabled standard library Matt Austern, Gabriel Dos Reis, Eric Niebler, Bjarne Stroustrup, Herb Sutter, Andrew Sutton, Jeffrey Yasskin 2014-11-04 2014-11   Concepts  
N4264 Propogate_const Jonathan Coe   N4209   Library  
N4265 Transactional Memory Support for C++: Wording (revision 3) Jens Maurer 2014-11-07 2014-11   Core  
N4266 Attributes for namespaces and enumerators Richard Smith 2014-11-05 2014-11   Core Adopted 2014-11
N4267 Adding u8 character literals Richard Smith 2014-11-05 2014-11   Core Adopted 2014-11
N4268 Allow constant evaluation for all non-type template arguments Richard Smith 2014-11-05 2014-11   Core Adopted 2014-11
N4269 No sane compiler would optimize atomics JF Bastien   missing   Core  
N4270 Consolidated Revisions to C++ Extensions for Library Fundamentals Alisdair Meredith 2014-11-07 2014-11 N4081 Library Adopted 2014-11
N4271 Minimal Incomplete Type Support for Standard Containers Zhihao Yuan   missing      
N4272 Working Draft, Technical Specification for C++ Extensions for Transactional Memory Michael Wong 2014-11-07 2014-11 N4179 Transactional Memory  
N4273 Uniform Container Erasure (Revision 2) Stephan T. Lavavej 2014-11-06 2014-11   Library Adopted 2014-11
N4274 Relaxing Packaging Rules for Exceptions Thrown by Parallel Algorithms - Proposed Wording (Revision 1) Arch D. Robison, Jared Hoberock, Artur Laksberg 2014-11-14 2014-11 N4157 Concurrency  
N4275 Parallelism PDTS Comment Responses Hans-J. Boehm 2014-11-07 2014-11   Concurrency Adopted 2014-11
N4276 Adding Fused Transform Algorithms to the Parallelism TS Jared Hoberock 2014-11-05 2014-11   Concurrency Adopted 2014-11
N4277 TriviallyCopyable reference_wrapper (Revision 1) Agustín Bergé 2014-11-06 2014-11 N4151 Library Adopted 2014-11
N4278 Concurrency TS Editor's Report Artur Laksberg   missing   Concurrency  
N4279 Improved insertion interface for unique-key maps (Revision 2.3) Thomas Köpp 2014-11-07 2014-11 N4240 Library Adopted 2014-11
N4280 Non-member size() and more (Revison 2) Riccardo Marcangelo 2014-11-06 2014-11 N4155 Library Adopted 2014-11
N4281 C++ Latches and Barriers Alasdair Mackintosh, Olivier Giroux   missing N4204 Library  
N4282 A Proposal for the World's Dumbest Smart Pointer, v4 Walter E. Brown 2014-11-07 2014-11 N3840 Library Adopted 2014-11
N4283 Atomic View Carter Edwards   missing   Concurrency  
N4284 Contiguous Iterators Jens Maurer 2014-11-07 2014-11 N4132 Library Adopted 2014-11
N4285 Cleanup for exception-specification and throw-expression Jens Maurer 2014-11-07 2014-11 N4133 Library Adopted 2014-11
N4286 Resumable Functions (revision 3) Gor Nishanov, Jim Radigan 2014-11-18 2014-11 N4134 Evolution  
N4287 Threads, Fibers and Couroutines (slides deck) Gor Nishanov 2014-11-18 2014-11   Evolution  
N4288 Strike string_view::clear from Library Fundamentals Alisdair Meredith 2014-11-07 2014-11   Library Adopted 2014-11
N4289 Library support for runtime contract violations Nathan Myers   missing   Library  
N4290 Language support for optional contract violations Nathan Myers   missing   Library  
N4291 Language support for block scope assertions Nathan Myers   missing   Library  
N4292 Language support for call-site assertions Nathan Myers   missing   Library  
N4293 C++ language support for contract programming J. Daniel Garcia 2014-11-23 2014-11   Evolution  
N4294 Arrays of run-time bounds as data members J. Daniel Garcia 2014-11-23 2014-11 N3875 Evolution  
N4295 Folding Expressions Andrew Sutton, Richard Smith 2014-11-07 2014-11 N4191 Core Adopted 2014-11
N4296 Working Draft, Standard for Programming Language C++ Richard Smith 2014-11-19 2014-11 N4140    
N4297 Editor's Report -- Programming Languages -- C++ Richard Smith 2014-11-19 2014-11      
N4298 Agenda and Meeting Notice for WG21 Ballot Resolution Telecon Meeting Herb Sutter 2011-11-14 2014-11      
N4299 Source Code Information Capture Robert Douglas   missing      
N4300 Array View Carter Edwards   missing      
N4301 Working Draft, Technical Specification for C++ Extensions for Transactional Memory Michael Wong 2014-11-21 2014-11 N4179    
N4302 Technical Specification for C++ Extensions for Technical Specification for C++ Extensions for Transactional Memory Michael Wong 2014-11-21 2014-11      
N4303 Pointer Safety and Placement New Richard Smith, Hubert Tong 2014-11-21 2014-11   Core  
N4304 C++ Standard Core Language Active Issues, Revision 92 William M. Miller 2014-11-24 2014-11 N4192 Core  
N4305 C++ Standard Core Language Defect Reports and Accepted Issues, Revision 92 William M. Miller 2014-11-24 2014-11 N4193 Core  
N4306 C++ Standard Core Language Closed Issues, Revision 92 William M. Miller 2014-11-24 2014-11 N4192 Core  
N4307 National Body Comment -- ISO/IEC PDTS 19568 -- Technical Specification: C++ Extensions for Library Fundamentals Barry Hedquist 2014-11-12 2014-11      
N4308 National Body Comment -- ISO/IEC PDTS 19570 -- Technical Specification: C++ Extensions for Parallelism Barry Hedquist 2014-11-12 2014-11      
N4309 Return type deduction for explicitly-defaulted and deleted special member functions Michael Price 2014-11-17 2014-11   Evolution  
N4310 Working Draft, Technical Specification for C++ Extensions for Parallelism Jared Hoberock 2014-11-21 2014-11 N4104    
N4311 Parallelism TS Editor's Report Jared Hoberock 2014-11-21 2014-11      
N4312 Programming Languages -- Technical Specification for C++ Extensions for Parallelism Jared Hoberock 2014-11-21 2014-11      
N4313 Improvements to the Concurrency Technical Specification, revision 1 Artur Laksberg 2014-11-21 2014-11 N4123 Concurrency  
N4314 Data-Invariant Functions (revision 2) Jens Maurer 2014-11-15 2014-11 N4145 Library Evolution  
N4315 make_array, revision 3 Zhihao Yuan 2014-11-07 2014-11 N4065 Library  
N4316 std::rand replacement, revision 2 Zhihao Yuan 2014-11-08 2014-11 N4217 Library  
N4317 New Safer Functions to Advance Iterators Patrick Grace 2014-11-17 2014-11   Library Evolution  
N4318 Proposal to add an absolute difference function to the C++ Standard Library Jeremy Turnbull 2014-09-21 2014-11   Library Evolution  
N4319 Contracts for C++: What are the Choices Gabriel Dos Reis, Shuvendu Lahiri, Francesco Logozzo, Thomas Ball, Jared Parsons 2014-11-23 2014-11   Evolution  
N4320 Make exception specifications be part of the type system Jens Maurer 2014-11-20 2014-11   Evolution  
N4321 Towards Implementation and Use of memory_order_consume Paul McKenney 2014-10-05 2014-11 N4215 Concurrency  
N4322 Linux-Kernel Memory Model Paul McKenney 2014-11-20 2014-11   Concurrency  
N4323 Out-of-Thin-Air Execution is Vacuous Paul McKenney 2014-11-20 2014-11 N4216 Concurrency  
N4324 Use Cases for Thread-Local Storage Paul McKenney 2014-11-20 2014-11   Concurrency  
N4325 C++ Standard Evolution Active Issues List (Revision R10) Ville Voutilanen 2014-11-21 2014-11 N4206 Evolution  
N4326 C++ Standard Evolution Completed Issues List (Revision R10) Ville Voutilanen 2014-11-21 2014-11 N4207 Evolution  
N4327 C++ Standard Evolution Closed Issues List (Revision R10) Ville Voutilanen 2014-11-21 2014-11 N4208 Evolution  
N4328 C++ Standard Library Issues History for C++14 Alisdair Meredith 2014-11-24 2014-11   Library  
N4329 C++ Standard Library Active Issues List (Revision R91) Alisdair Meredith 2014-11-24 2014-11 N4245 Library  
N4330 C++ Standard Library Defect Report List (Revision R91) Alisdair Meredith 2014-11-24 2014-11 N4246 Library  
N4331 C++ Standard Library Closed Issues List (Revision R91) Alisdair Meredith 2014-11-24 2014-11 N4247 Library  
N4332 Networking Library Proposal (Revision 3) Christopher Kohlhoff 2014-11-21 2014-11 N4243 Concurrency  
N4333 Concepts Lite Andrew Sutton 2014-11-21 2014-11 N4205 Core  
N4334 Wording for bool_constant Zhihao Yuan 2014-11-21 2014-11   Library  
N4335 Working Draft, C++ Extensions for Library Fundamentals Jeffrey Yasskin 2014-11-21 2014-11 N4081 Library Evolution  
N4336 Working Draft, C++ Extensions for Library Fundamentals, Version 2 Jeffrey Yasskin 2014-11-21 2014-11 N4084 Library Evolution  
N4337 Editor's Report for the Library Fundamentals TS Jeffrey Yasskin 2014-11-21 2014-11   Library Evolution  
N4338 Editor's Report: Technical Specification for C++ Extensions for Transactional Memory Michael Wong 2014-11-21 2014-11   Transactional Memory  
N4339 Agenda and Meeting Notice for WG21 Concepts Meeting Herb Sutter 2014-11-21 2014-11      

 

Free CppCat for Students

CppCat is a static code analyzer integrating into the Visual Studio 2010-2013 environment. The analyzer is designed for regular use and allows detecting a large number of various errors and typos in programs written in C and C++. For the purpose of popularizing it, we've decided to launch a student-support program granting free licenses to every higher school student who will contact and ask us about that. You just need to send us a photo of your student card or transcript.

A few words about static code analysis

Static code analysis tools draw the programmer's attention to those fragments which are very likely to contain errors. Here's a simple example:

double var_z;

....

var_z = ( var_z - 16 / 116 ) / 7.787;

This code is correct from the viewpoint of the language and compiler. It's just a regular situation when division of the integer number 16 by integer number 116 results in 0. Expressions like that are necessary sometimes. However, the analyzer takes a wider perspective of the code and detects an error pattern: if the result of such an integer division is then used together with the double type, it may signal something is wrong.

The analyzer will draw your attention to this suspicious division with the following warning: V636 The '16 / 116' expression was implicitly casted from 'int' type to 'double' type. Consider utilizing an explicit type cast to avoid the loss of a fractional part. An example: double A = (double)(X) / Y;. color.c 125

The code was most likely meant to look as follows:

var_z = ( var_z - 16.0 / 116.0 ) / 7.787;

The division now results in 0,137931 instead of 0.

Static analysis tools can be treated as an extension to compiler warnings. Unlike the compiler, analyzers deal with higher-level constructs and rely on empirical methods trying to guess if the code works the way the programmer wanted it to.

A few words about the CppCat analyzer

CppCat is a static code analyzer which is easy to set and use. It is an excellent tool to get started with the static analysis methodology. It is not as powerful as its big brother PVS-Studio (see their comparison), but it is more than sufficient for most tasks. In any case, CppCat's functionality is surely quite enough for students and single developers.

The analyzer can integrate into Visual Studio 2010, 2012, 2013. Unfortunately, it can't integrate into Express editions and we can't help it as Visual Studio Express editions don't support plugins.

The analyzer supports the following languages: C, C++, C++/CLI, C++/CX.

An important feature of the analyzer is an automated analysis of freshly modified code. After compilation of modified files is finished, CppCat starts analyzing the code in background and displays a warning whenever anything suspicious is found. This feature allows programmers to detect errors at the very early development stage and thus save time on bug search and fixes.

You can download CppCat from the product's website: http://www.cppcat.com

How to get a CppCat license

Using CppCat will help you in acquiring skills of working with static analysis tools and improving your qualification. Static analyzers are growing more and more popular nowadays, so it'll be just good if you can specify in your résumé that you know how to use these tools.

To get a license you just need to send to our email [email protected] a photo or scan of your student card, transcript or other document confirming that you are a higher school student. Please specify your first and second name and the name of your university as it might be very difficult to make out this information from the photo. These data will be used to generate your personal registration key.

The license will be valid through 1 year. If you wish to be able to use CppCat after that, you will have to send us a new photo of your student card.

Building Portable Games in C++ -- Guy Kogus

Fresh on Dr. Dobb's:

Building Portable Games in C++

By Guy Kogus

The cocos-2d-x open source framework can be used to build games, apps, and other interactive software in C++. Here's a hands-on guide to using it to write and port games.

From the article:

Our game, Ready Steady Bang, was written using cocos2d-iphone, which we were considering using for our next game, Ready Steady Play. Then I remembered the C++ gaming framework cocos2d-x and its promise of cross-platform compilation.

In this article, I break down how I developed the Ready Steady Play game using cocos2d-x and discuss the porting travails of moving the final code from iOS to Android and Windows Phone 8. I used v2.2.x of cocos-2dx, but most of this text should be applicable for v3.x...

Container Algorithms -- Eric Niebler

eric-niebler-toronto.PNGSome more details about the Ranges proposal that was well received by the ISO C++ committee at this month's meeting in Urbana-Champaign:

Container Algorithms

by Eric Niebler

From the article:

... So to sum up, in the world of N4128, we have this:

  • Eager algorithms that can mutate but that don’t compose.
  • Lazy algorithms that can’t mutate but do compose.

Whoops! Something is missing. If I want to read a bunch of ints, sort them, and make them unique, here’s what that would look like in N4128:

extern std::vector<int> read_ints();
std::vector<int> ints = read_ints();
std::sort(ints);
auto i = std::unique(ints);
ints.erase(i, ints.end());

Blech! A few people noticed this shortcoming of my proposal. A week before the meeting, I was seriously worried that this issue would derail the whole effort. I needed a solution, and quick.

Container Algorithms

The solution I presented in Urbana is container algorithms. These are composable algorithms that operate eagerly on container-like things, mutating them in-place, then forwarding them on for further processing. For instance, the read+sort+unique example looks like this with container algorithms:

std::vector<int> ints =
    read_ints() | cont::sort | cont::unique;

Much nicer. Since the container algorithm executes eagerly, it can take a vector and return a vector. The range views can’t do that...

Call for volunteers: isocpp.org blog editors

We are looking for additional volunteers to be isocpp.org blog editors.

Here's what you'd do: Just read your daily RSS and other web feeds, which you're probably doing anyway -- we'll suggest a few additional feeds as appropriate ones to watch for your blog section. Then, whenever you encounter a high-quality item that you think would be of broad interest to other modern C++ developers, share it on the isocpp.org blog by posting a brief "link-to style" blog item that lets our readers know about it. Each link-item would consist of just a one-line introductory blurb, a link to the post, and an interesting representative "from the article" passage to give the reader an idea of what it's about so they can decide whether to click and read further. See the isocpp.org style guide for an example of the content and editing.

Here are the roles we are seeking to fill, with a recent example of each type of post:

  • Articles & Books editors to link to new articles, such as experience reports about using modern C++ in a project, insights about using a particular C++ feature, and related things like announcements of new high-quality modern C++ books. Example: linking to a good experience report about using modern C++.
  • "Quick Q" editors to link to useful new Q&A on sites like StackOverflow or Reddit, to make readers aware of interesting questions that have correct answers. Example: linking to a good StackOverflow question.
  • Product News editors to link to announcements about compilers, libraries, and OSS projects of interest. We'd especially like to see more posts about OSS libraries that people maybe don't know about, but should. Example: linking to a good product blog post.
  • Video & Events editors to link to new high-quality videos on C++ topics, and to announcements relating to upcoming C++ events. Examples: see the blog's video category and events category for examples.

Requirements: You should be reasonably familiar with modern C++ so that you can judge whether a prospective item is reasonably accurate, modern, and of likely broad interest to C++ developers. Note that we are actively looking for items at all levels -- introductory (such as how to use a basic C++ features), intermediate, advanced, and "experimental." We want the blog to show a balanced mix of these -- our site should reflect the full range of our community.

Workload: The expected volume will usually be about 2-5 links per week, which should take less than 15 minutes per week of your time. Once you've found something to link to during your usual reading, it only takes a couple of minutes to write the blog post to tell others about it.

Honorarium: A modest honorarium is available for students who are accepted as blog editors. If you are a student and interested in the honorarium, please mention this in your inquiry email.

If you are interested in becoming an isocpp.org blog editor, please inquire at [email protected].

Updates to my trip report

I wanted to add a few more things to my meeting trip report. I updated the trip report in-place, but for those who want to see the "diffs" I'll also post just the new parts here as a standalone post:

There were 106 experts at this meeting, officially representing 7 nations. This meeting saw a recent-record number of papers, including over 120 in the pre-meeting mailing.

In addition to the other things I mentioned, we also approved several other interesting changes, including the following highlights:

  • Adopted N4230, which allows nested namespace definitions like namespace A::B::C { } as a convenient shorthand for namespace A { namespace B { namespace C { } } }.
  • Adopted N3922, which fixes the most common pitfall with auto and {}, so that auto x{y}; now deduces the sane and expected thing, namely the type of y. Before this, it deduced initializer_list which was unfortunate and surprising. So, fixed.
  • Adopted N4086, which removes trigraphs. Yes, we removed something from C++... and something that was inherited from C! But wait, there's more...
  • Adopted N4190, and actually removed (not just deprecated) several archaic things from the C++ standard library, including auto_ptr, bind1st/bind2nd, ptr_fun/mem_fun/mem_fun_ref, random_shuffle, and a few more. Those are now all removed from the draft C++ 17 standard library and will not be part of future portable C++.

We also did work and made progress on a lot of other proposals, including modules. See the pre-meeting mailing for details about papers considered at this meeting.

 

Can Qt's moc be replaced by C++ reflection? -- Olivier Goffart

In case you missed it:

Can Qt's moc be replaced by C++ reflection?

by Olivier Goffart

From the article:

The Qt toolkit has often been criticized for extending C++ and requiring a non-standard code generator (moc) to provide introspection.
Now, the C++ standardization committee is looking at how to extend C++ with introspection and reflection. As the current maintainer of Qt's moc I thought I could write a bit about the need of Qt, and even experiment a bit.

In this blog post, I will comment on the current proposal draft, and try to analyze what one would need to be able to get rid of moc.

Trip Report: Fall ISO C++ Meeting

[Updated 11/24 to add a few more details]

The fall ISO C++ meeting was held on November 3-8 in Urbana-Champaign, IL, USA. Many thanks again to Riverbed Technology and the University of Illinois at Urbana-Champaign for hosting us! [ETA: There were 106 experts at this meeting, officially representing 7 nations. This meeting saw a recent-record number of papers, including over 120 in the pre-meeting mailing.]

As usual, we met for six days, starting Monday morning and ending on Saturday afternoon. This week was especially action-packed, and we had working sessions around the clock continuously from 9:00am Monday until 3:00pm Saturday, with the only breaks being short lunch and dinner breaks, and roughly 10pm-8am for sleep and breakfast (though, also as usual, many paper authors whose proposals were making progress opted to spend part of their sleep time updating their papers).

This is the first meeting since C++14 was officially completed, and so this was the first “C++17 era” meeting. We adopted a number of proposals directly into the C++ working draft that will become C++17, and adopted other proposals into other Technical Specifications that are developing independently from the core standard and may be folded into the C++ standard itself in the future.

Sadly, this was the last meeting for retiring long-time U.S. committee chair Steve Clamage who has done a tireless and much-appreciated job herding the cats for the past 20 or so years. Steve is one of the five remaining original members of the ISO C++ committee who had attended the first ISO C++ organizational meeting back in 1989 and has still been attending up to this month's meeting; the others are Pete Becker, Mike Miller, Tom Plum, and Bjarne Stroustrup. Thanks again, Steve, for all your contributions to ISO C++, and happy retirement! The new chair of the U.S. committee is Clark Nelson, who has long served as vice-chair. In turn, the new vice-chair is John Spicer.

Milestones

Four major milestones were achieved that will result in issuing four ISO ballots:

  • The Transactional Memory TS was approved to be sent out for its primary comment ballot, known as PDTS ballot. This is the first of two ballot stages for a TS.
  • The Parallelism TS was approved to be sent out for its final ballot, known as DTS ballot.
  • The Library Fundamentals TS was approved to be sent out for its final DTS ballot.
  • Also, in what amounts to a ribbon-cutting ceremony, I was also directed to officially request a New Work Item for the next C++ standard itself, which is expected to be C++17.

We adopted a number of proposals, which are covered in the following isocpp.org posts:

[ETA: We also approved several other interesting changes, including the following highlights:

  • Adopted N4230, which allows nested namespace definitions like namespace A::B::C { } as a convenient shorthand for namespace A { namespace B { namespace C { } } }.
  • Adopted N3922, which fixes the most common pitfall with auto and {}, so that auto x{y}; now deduces the sane and expected thing, namely the type of y. Before this, it deduced initializer_list which was unfortunate and surprising. So, fixed.
  • Adopted N4086, which removes trigraphs. Yes, we removed something from C++... and something that was inherited from C! But wait, there's more...
  • Adopted N4190, and actually removed (not just deprecated) several archaic things from the C++ standard library, including auto_ptr, bind1st/bind2nd, ptr_fun/mem_fun/mem_fun_refrandom_shuffle, and a few more. Those are now all removed from the draft C++17 standard library and will not be part of future portable C++.

We also did work and made progress on a lot of other proposals, including modules. See the pre-meeting mailing for details about papers considered at this meeting.]

Happily, at least for me, two of my own proposals were adopted at this meeting.

First, Andrei Alexandrescu inspired me to write and pursue what became adopted via paper N4259, to add the new function int std::uncaught_exceptions() noexcept; to the standard library that returns the number of active exceptions in this thread. This will enable a portable ScopeGuard that can automatically detect success/failure without asking the user to write a manual .Dismiss() or forcing the ScopeGuard implementation to rely on undocumented compiler artifacts (which, ahem, Andrei’s implementation had been doing on GCC, Clang, and MSVC – figuring out where the compilers were already storing this very exception count information and doing the world’s most contorted reinterpret_cast<int*>s to get access to the count. I expect C++ implementations to implement this aggressively – in fact, I believe it was implemented for either libc++ or libstdc++ two days later. Finally, while they were at it, the committee also decided to deprecate the old std::uncaught_exception() which has long been known to be almost-but-not-quite what is wanted.

Second, Scott Meyers inspired and demonstrated the need for a name for T&& references – that is, where T is a template parameter type and the reference could “become” const or non-const, rvalue or lvalue. This is different enough that it, and more importantly its intended usage, needs a name. In the absence of a special name for this provided by the committee, Scott initially called these “universal references.” A number of experts agreed there should be a name, but that “forwarding references” was better, and Scott himself had used that term in the past. The committee agreed, and via N4262 has now added the term “forwarding reference” to the draft standard. As icing on the cake, not only is the term in normative text, but it’s promoted to a formal “term of power” that the draft standard itself now already uses in two places to replace the old longer phrase-that-really-needed-a-name. (We would have been satisfied with a non-normative note; it’s nifty that the committee itself found it useful to have a name for this thing to improve the specification of the standard itself.)

Many thanks again to Scott and Andrei for popularizing and demonstrating the need for these features and the form they could take in the standard.

I also presented my atomic smart pointers proposal, for atomic versions of unique_ptr, shared_ptr, and weak_ptr. These were accepted by the Concurrency subgroup (SG1), approved by the Library Evolution Group, and received initial wording review in the core Library Working Group. Hopefully this paper, or a minor update, will be ready to be adopted into the Concurrency TS at our next meeting in May.

Finally, I had proposed allowing a return statement to be allowed to call explicit constructors, and at our summer meeting in Rapperswil the Evolution Working Group agreed with allowing the syntax “return { /* whatever */ };” to invoke explicit constructors, and I got to final wording in the Core Working Group which is the last stage before it is brought before the full committee for approval. However, because this proved to be controversial in the larger group, I voluntarily withdrew the proposal – at least for the time being, and I don’t currently plan to bring it forward again.

Evening sessions

We had five evening sessions on specific topics of broad interest. Most were attended by a majority of the full committee.

On Monday evening, most of the committee spent three hours on coroutines and fibers. There were three major concurrency proposals related to smaller-than-thread concurrency such as resumable functions. At the end, the group expressed a strong direction to pursue coroutines and fibers (as strawman names) as distinct concurrency primitives, in addition to threads. Broadly, the key distinction is that a fiber enables cooperative scheduling of multiple stacks within a thread – that is, a fiber is a unit of work smaller than a thread but with its own stack, and that can be assigned to run on a thread; whereas a coroutine is an ultra-lightweight unit of work that is smaller still and does not have its own stack.

On Tuesday evening, we spent another three hours on contracts – preconditions, postconditions, and invariants. The group gave some direction on preferred directions and we expect to see updated proposal(s) for our next meeting.

On Wednesday evening, we spent two hours on ranges. Eric Niebler presented a design and prototype implementation for ranges and range-based algorithms, expressed using fully modern C++14 plus the Concepts TS language features, although it could be implemented without language support for Concepts. There was extensive Q&A and palpable excitement and a unianimous vote to encourage the author to return with proposed standardese wording that could be wordsmithed and hopefully adopted at a future meeting.

Thursday evening was devoted to pattern matching. This flexible set of facilities could provide a general framework that would subsume a number of other proposals, ranging from a more flexible form of the ordinary switch statement, possibly all the way to the “static if” style proposals.

Friday evening was devoted to reflection proposals, focusing on compile-time reflection facilities for C++. I left at 9:30, but later heard that the session continued nearly another two hours afterwards.

Next meetings

Our next full WG21 face-to-face meeting will be on May 4 to 9 in Lenexa, Kansas, USA.

In the meantime, over the winter we’ll be having several other smaller face-to-face and telecon meetings on specific topics.

  • The Concepts specification working paper will continue to be reviewed in two telecons in December and January, with a three-day face-to-face meeting on January 26-28 in Skillman, New Jersey, USA, at which we hope to approve the document to be sent out for its main comment ballot (PDTS). This meeting is being hosted by Bloomberg and Edison Design Group.
  • The Library groups will be holding a full-week face-to-face meeting on February 23-27 in Cologne, Germany to work specifically on the issues lists for the existing standard library at a meeting that is not also considering new features; think of it as a “bug bash” meeting. This meeting is being hosted by Josuttis Eckstein and ParStream.

Many thanks especially to the meeting hosts for graciously volunteering to organize these meetings!

 

N4332: Networking Library Proposal (Revision 3) -- Christopher Kohlhoff

New WG21 papers are available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4332

Date: 2014-11-21

Networking Library Proposal (Revision 3)

by Christopher Kohlhoff

Excerpt:

1. Introduction

In the June 2014 committee meeting in Rapperswil, LEWG requested that Boost.Asio-based N2175 Networking Library Proposal for TR2 (Revision 1) be updated for C++14 and brought forward as a proposed Networking Technical Specification. This document is that revision. As well as updating the proposal for C++14, it incorporates improvements to Asio that are based on the widespread field experience accumulated since 2007.

The Boost.Asio library, from which this proposal is derived, has been deployed in numerous systems, from large (including internet-facing HTTP servers, instant messaging gateways and financial markets applications) to small (mobile phones and embedded systems). The Asio library supports, or has been ported to, many operating systems including Linux, Mac OS X, Windows (native), Windows Runtime, Solaris, FreeBSD, NetBSD, OpenBSD, HP-UX, Tru64, AIX, iOS, Android, WinCE, Symbian, vxWorks and QNX Neutrino.

2. Changes in this revision

Revision 3 addresses issues raised by LEWG in Urbana and includes the following changes:

  • String conversions and string parameters have been updated and use string_view where appropriate.
  • The header arrangement has been altered to reduce the number of header files, add a convenience header, and add a forward declarations header.
  • A diagram has been added to show the relationship between the core socket class templates.

3. Reference implementation

An almost complete implementation of the proposal text may be found in a variant of Asio that stands alone from Boost. This variant is available at https://github.com/chriskohlhoff/asio/tree/master.