Standardization

New Options for Managing Character Sets in the Microsoft C/C++ Compiler--Jim Springfield

A new post from the Visual C++ team about how VC++ has evolved in the past for supporting different characters sets, and what's new:

New Options for Managing Character Sets in the Microsoft C/C++ Compiler

by Jim Springfield

From the article:

The Microsoft C/C++ compiler has evolved along with DOS, 16-bit Windows, and 32/64-bit Windows.  Its support for different characters sets, code pages, and Unicode has also changed during this time...

N4578-79: Parallelism TS2 proposed working draft

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.

N4578: Working Draft, Technical Specification for C++ Extensions for Parallelism Version 2 (Jared Hoberock)

N4579: Parallelism TS Editor’s Report (Jared Hoberock)

N4578 is the proposed working draft of Parallelism TS Version 2. It contains technical changes to the Parallelism TS to apply the following revision:

  • P0155R0 - Task Block R5

N4578 updates the previous draft, N4505, published in the post-Lenexa mailing.

Technical Changes

  • Applied P0155R0, which introduces support for fork-join task parallelism

via task blocks.

 

A bit of background for the operator dot proposal -- Bjarne Stroustrup

Over the years, there have been several suggestions and proposals for allowing programmers to define operator.() so as  to be able to provide “smart references” similar to the way we provide “smart pointers.” I first considered that in 1983, but couldn’t solve the problem. In early 2014, Gabriel Dos Reis and I decided that now we really had to solve it: Too much code was getting too complicated and too ugly because of the lack of smart references. Operator -> is good for objects with pointer semantics, but we needed a general way of providing value semantics for a handle.

Operator dot differs from other operators by having its right-hand operand be a name rather than a value: for x.m, m is not the value of some variable it is the name of a member of some class. Ideally, dot would be a binary operator taking into account both x and m for x.m. Many have tried, including Gaby and I, but that quickly gets complicated. The current rules for operator->() and the proposed design for operator.() “solves” those problems by considering the right-hand operand only when looking for possible candidates. This allows composition of interfaces without requiring inheritance. If someone figures out a good and simple way of taking the member name into account in a more general form, we are reasonably sure that we have not proposed anything that prevents that. When designing, you must always try to avoid painting yourself into a corner by closing off possible evolution paths.

Historically, the key sticking point with the operator.() proposals has been how to distinguish operations on the reference object (the handle) from operations on the referred-to object (the value). The current proposal “forwards” every operation to the referred-to object unless that operation has been explicitly declared in the handle. This is simple and quite general. In particular, we can apply operators on a smart reference (e.g., ++r) and have ++ apply to reference is we so desire, but by default it is applied to the referred-to object (as it would for a built-in reference). The papers outline why we think that this is – by far – the design that best balances the needs of the various use cases. The focus is on allowing the user to define a class that is a reference, just like the built-in reference, except that it is “smart” in some way (e.g., it can have a rebind() member) analogously to the way a “smart pointer”  is just like a pointer except that it is “smart” in some way (e.g., takes care of ownership). If you can define or use a smart pointer, you can define or use a smart reference.

The proposal has been quite stable. There have been proposals for alternatives and major extensions, but few suggested modifications. We tried to find a way to prevent a pointer (or reference) to the referred-to object to escape from the smart reference, but couldn’t find a simple way of guaranteeing that so we gave up, quoting “C++ protects against Murphy, not Machiavelli.” We ensured that you can define a matching set of smart . (dot), -> (arrow), * (dereference), and [] (subscript) operators with the relations they have for built-in types.

2016-02 Pre-Jacksonville mailing available

The 2016-02 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
2016-02 pre-Jacksonville
N4568 PL22.16/WG21 draft agenda: 29 Feb-05 Mar 2016, Jacksonville, FL/US Clark Nelson 2015-12-01 2016-02      
N4569 Proposed Ranges TS working draft Eric Niebler 2016-02-15 2016-02      
N4570 Oulu Meeting Information Ville Voutilainen 2016-01-08 2016-02      
N4571 2016-11 Issaquah meeting information Herb Sutter 2016-01-21 2016-02      
N4572 WG21 telecon meeting: Pre-Jacksonville Herb Sutter 2016-01-27 2016-02      
N4573 2017-02 Kona WG21 Meeting Information Thomas Plum 2016-02-02 2016-02      
N4574 Withdrawn            
N4575 Networking TS Working Draft Jonathan Wakely 2016-02-15 2016-02      
N4576 Networking TS Editor's Report Jonathan Wakely 2016-02-15 2016-02      
N4577 Technical Specification for C++ Extensions for Concurrency Artur Laksberg 2016-02-15 2016-02      
P0003R1 Removing Deprecated Exception Specifications from C++17 Alisdair Meredith 2016-02-09 2016-02 P0003R0 Core  
P0005R3 Adopt not_fn from Library Fundamentals 2 for C++17 Alisdair Meredith, Stephan T. Lavavej, Tomasz Kamiński 2016-11-10 2016-02 P0005R2 Library  
P0009R1 Polymorphic Multidimensional Array View H. Carter Edwards, Christian Trott, Juan Alday, Jesse Perla, Mauro Bianco, Robin Maffeo, Ben Sander, Bryce Lelbach 2016-02-04 2016-02 P0009R0 Library Evolution, Evolution  
P0010R0 Adding a subsection for concurrent random number generation in C++17 Pattabhi Raman 2015-11-25 2016-02   Library  
P0018R2 Lambda Capture of *this by Value H. Carter Edwards, Daveed Vandevoorde, Christian Trott, Hal Finkel, Jim Reus, Robin Maffeo, Ben Sander 2015-11-30 2016-02 P0018R1 Evolution  
P0019R1 Atomic View H. Carter Edwards, Hans Boehm, Olivier Giroux, James Reus 2015-02-04 2016-02 P0019R0 Concurrency  
P0020R1 Floating Point Atomic H. Carter Edwards, Hans Boehm, Olivier Giroux, JF Bastien, James Reus 2015-02-04 2016-02 P0020R0 Concurrency  
P0024R1 The Parallelism TS Should be Standardized Jared Hoberock 2016-02-12 2016-02 P0024R0 Concurrency  
P0028R1 Using non-standard attributes J. Daniel Garcia, Luis M. Sanchez, Massimo Torquati, Marco Danelutto, Peter Sommerlad 2016-02-12 2016-02 P0028R0 Evolution  
P0033R1 Re-enabling shared_from_this (revision 1) Jonathan Wakely, Peter Dimov 2015-10-24 2016-02 P0033R0 Library Evolution  
P0035R1 Dynamic memory allocation for over-aligned data Clark Nelson 2015-12-29 2016-02 P0035R0 Evolution  
P0037R1 Fixed point real numbers John McFarlane 2016-02-11 2016-02 P0037R0 Library Evolution, SG14  
P0040R1 Extending memory management tools Brent Friedman 2016-01-10 2016-02 P0040R0 Library Evolution, SG14  
P0046R1 Change is_transparent to metafunction Tomasz Kamiński 2016-01-30 2016-02 P0046R0 Library Evolution  
P0052R1 Generic Scope Guard and RAII Wrapper for the Standard Library Peter Sommerlad, Andrew L. Sandoval 2016-02-12 2016-02 P0052R0 Library  
P0055R1 On Interactions Between Coroutines and Networking Library Gor Nishanov 2016-02-12 2016-02 P0055R0 Library Evolution  
P0057R2 Wording for Coroutines Gor Nishanov 2016-02-12 2016-02 P0057R1 Core, Library Evolution  
P0058R1 An Interface for Abstracting Execution Jared Hoberock, Michael Garland, Olivier Girioux 2016-02-12 2016-02 P0058R0 Concurrency  
P0059R1 Add rings to the Standard Library Guy Davidson, Arthur O'Dwyer 2016-02-09 2016-02 P0059R0 SG14, Library Evolution  
P0063R1 C++17 should refer to C11 instead of C99 Clark Nelson, Hans Boehm 2016-02-12 2016-02 P0063R0 Library Evolution  
P0067R1 Elementary string conversions Jens Maurer 2016-02-12 2016-02 P0067R0 Library Evolution  
P0072R1 Light-Weight Execution Agents Torvald Riegel 2016-02-12 2016-02 P0072R0 Concurrency  
P0073R1 On unifying the coroutines and resumable functions proposals Torvald Riegel 2016-02-12 2016-02 P0073R0 Evolution  
P0075R1 Template Library for Index-Based Loops Arch Robison, Pablo Halpern, Robert Geva, Clark Nelson 2016-02-12 2016-02 P0075R0 Library  
P0076R1 Vector and Wavefront Policies Arch Robison, Pablo Halpern, Robert Geva, Clark Nelson, Jens Maurer 2016-02-12 2016-02 P0076R0 Concurrency  
P0077R1 is_callable, the missing INVOKE related trai Agustín Bergé 2016-02-12 2016-02 P0077R0 Library Evolution  
P0082R1 For Loop Exit Strategies (Revision 1) Alan Talbot 2016-02-14 2016-02 P0082R0 Evolution  
P0088R1 Variant: a type-safe union that is rarely invalid (v5) Axel Naumann 2016-02-13 2016-02 P0088R0 Library Evolution  
P0089R1 Quantifying Memory-Allocatiom Strategies John Lakos, Jeffrey Mendelsohn, Alisdair Meredith, Nathan Myers 2016-02-12 2016-02 P0089R0 Library Evolution  
P0091R1 Template parameter deduction for constructors (Rev. 3) Mike Spertus, Faisal Vali, Richard Smith 2016-02-15 2016-02 P0091R0 Evolution  
P0096R1 Feature-testing recommendations for C++ Clark Nelson 2016-01-19 2016-02 P0096R0 Feature Testing  
P0119R1 Overload sets as function arguments Andrew Sutton 2016-02-12 2016-02 P0119R0 Evolution  
P0122R1 span: bounds-safe views of objects for sequences Neil MacIntosh 2016-02-11 2016-02 P0122R0 Library Evolution  
P0123R1 string_span: bounds-safe views for sequences of characters Neil MacIntosh 2016-02-11 2016-02 P0123R0 Library Evolution  
P0124R1 Linux-Kernel Memory Model Paul E. McKenney, Ulrich Weigand, Andrea Parri 2016-01-27 2016-02 P0124R0 Concurrency  
P0126R1 std::synchronic<T> Olivier Giroux 2016-02-12 2016-02 P0126R0 Concurrency  
P0128R1 constexpr_if Ville Voutilainen 2016-02-10 2016-02 P0128R0 Evolution  
P0138R1 Construction Rules for enum class Values Gabriel Dos Reis 2016-02-14 2016-02 P0138R0 Core  
P0142R0 A Module System for C++ (Revision 4) Gabriel Dos Reis 2016-02-15 2016-02   WG21  
P0143R0 Wording for Modules Gabriel Dos Reis 2015-11-30 2016-02   Core  
P0143R1 Wording for Modules Gabriel Dos Reis 2016-02-15 2016-02 P0143R0 Core  
P0144R1 Structured Bindings Herb Sutter, Bjarne Stroustrup, Gabriel Dos Reis 2016-02-03 2016-02 P0144R0 Evolution  
P0145R1 Refining Expression Evaluation Order for Idiomatic C++ (Revision 2) Gabriel Dos Reis, Herb Sutter, Jonathan Caves 2016-02-12 2016-02 P0145R0 Evolution, Core  
P0146R1 Regular Void Matt Calabrese 2016-02-11 2016-02 P0146R0 Evolution  
P0149R0 Generalised member pointers Jeff Snyder 2016-02-12 2016-02   Evolution  
P0161R0 Bitset Iterators, Masks, and Container Operations Nathan Myers 2016-02-12 2016-02   Library  
P0165R1 C++ Standard Library Issues to be moved in Jacksonville Marshal Clow 2016-02-12 2016-02 P0165R0 Library  
P0167R1 Core Language Working Group "ready" Issues for the February, 2016 (Jacksonville) meeting William M. Miller 2016-02-15 2016-02 P0167R0 Core  
P0174R0 Deprecating Vestigial Library Parts in C++17 Alisdair Meredith 2016-02-15 2016-02   Library Evolution  
P0175R0 Synopses for the C library Thomas Koeppe, Richard Smith 2016-02-13 2016-02   Library  
P0177R0 Cleaning up allocator_traits Alisdair Meredith 2016-02-15 2016-02   Library Evolution  
P0178R0 Allocators and swap Alisdair Meredith 2016-02-15 2016-02   Library Evolution  
P0180R0 Reserve a New Library Namespace Future Standardization Alisdair Meredith 2016-02-10 2016-02   Library Evolution  
P0181R0 Ordered By Default Alisdair Meredith 2016-02-17 2016-02   Library Evolution  
P0184R0 Generalizing the Range-Based For Loop Eric Niebler 2016-02-11 2016-02   Evolution  
P0185R0 Adding [nothrow-] swappable traits Daniel Krugler 2016-02-09 2016-02   Library  
P0186R0 Iterator Facade Library Proposal for Ranges Beman Dawes, Eric Niebler, Casey Carter 2016-02-11 2016-02   Library Evolution  
P0187R0 Proposal of Bitfield Default Member Initializers Andrew Tomazos 2015-11-20 2016-02   Evolution  
P0188R0 Wording for [[fallthrough]] attribute Andrew Tomazos 2016-01-03 2016-02 P0068R0 Evolution  
P0189R0 Wording for [[nodiscard]] attribute Andrew Tomazos 2016-01-03 2016-02 P0068R0 Evolution  
P0190R0 Proposal for New memory order consume Definition Paul E. McKenney, Michael Wong, Hans Boehm, Jens Maurer 2016-02-10 2016-02   Concurrency  
P0192R0 Adding a Fundamental Type for Short Float Boris Fomitchev, Sergei Nikolaev, Oliver Giroux 2015-11-11 2016-02   Evolution  
P0193R0 Where is Vectorization in C++‽ JF Bastien, Hans Boehm 2016-01-21 2016-02   Concurrency  
P0194R0 Static reflection (revision 4) Matus Chochlik, Axel Naumann 2016-02-08 2016-02 N4451 Reflection  
P0195R0 Modernizing using-declarations Robert Haberlach 2015-12-23 2016-02   Evolution  
P0196R0 A generic none_t literal type for Nullable types Vicente J. Botet Escriba 2016-02-11 2016-02   Library Evolution  
P0197R0 Default Tuple-like access Vicente J. Botet Escriba 2016-02-11 2016-02   Library Evolution  
P0198R0 Default Swap Vicente J. Botet Escriba 2016-02-11 2016-02   Library Evolution  
P0199R0 Default Hash Vicente J. Botet Escriba 2016-02-11 2016-02   Library Evolution  
P0200R0 A Proposal to Add Y Combinator to the Standard Library Yegor Derevenets 2016-01-22 2016-02   Library Evolution  
P0201R0 A cloning pointer-class for C++ Jonathan Coe 2016-02-01 2016-02   Library Evolution  
P0202R0 Add Constexpr Modifiers to Functions in and Headers Antony Polukhin 2016-01-31 2016-02   Library Evolution  
P0203R0 Considerations for the design of expressive portable SIMD vectors Mathias Gaunard 2016-01-26 2016-02   SG14  
P0205R0 Allow Seeding Random Number Engines With std::random_device Moritz Klammler 2016-02-11 2016-02   Numerics, Library Evolution, Library  
P0206R0 Discussion about std::thread and RAII Ville Voutilainen 2016-01-27 2016-02   Concurrency, Library Evolution  
P0207R0 Ruminations on lambda captures Ville Voutilainen 2016-01-28 2016-02   Evolution  
P0208R0 Copy-swap helper Pablo Halpern 2016-02-12 2016-02   Library Evolution  
P0209R0 make_from_tuple: apply for construction Pablo Halpern 2016-02-12 2016-02   Library Evolution  
P0210R0 A light-weight, dynamic array Thomas Koeppe 2016-01-29 2016-02   Library Evolution  
P0211R0 Allocator-aware library wrappers for dynamic allocation Thomas Koeppe 2016-01-30 2016-02   Library Evolution  
P0212R0 Wording for [[maybe_unused]] attribute Andrew Tomazos 2016-01-31 2016-02   Evolution  
P0213R0 Reexamining the Performance of Memory-Allocation Strategies Graham Bleaney 2016-01-24 2016-02   Library Evolution  
P0214R0 Data-Parallel Vector Types & Operations Matthias Kretz 2016-02-12 2016-02 N4385 Library Evolution  
P0215R0 A Civil-Time Library Greg Miller, Bradley White 2016-02-11 2016-02   Library Evolution  
P0216R0 A Time-Zone Library Greg Miller, Bradley White 2016-02-11 2016-02   Library Evolution  
P0217R0 Proposed wording for structured bindings Jens Maurer 2016-02-10 2016-02   Evolution, Core  
P0218R0 Adopt File System TS for C++17 Beman Dawes 2016-02-11 2016-02   Library, File System  
P0219R0 Relative Paths for Filesystem Beman Dawes, Jamie Allsop, Nicolai Josuttis 2016-02-12 2016-02   Library, File System  
P0220R0 Adopt Library Fundamentals TS for C++17 Beman Dawes 2016-02-12 2016-02   Library, Library Evolution  
P0221R0 Proposed wording for default comparisons, revision 2 Jens Maurer 2016-02-10 2016-02 N4532 Evolution  
P0222R0 Allowing Anonymous Structs as Return Values Matthew Woehlke 2016-02-05 2016-02   Evolution  
P0223R0 Class Namespace Matthew Woehlke 2016-02-09 2016-02   Evolution  
P0224R0 Implicit Return Type Matthew Woehlke 2016-02-05 2016-02   Evolution  
P0225R0 Why I want Concepts, and why I want them sooner rather than later Ville Voutilainen 2016-02-05 2016-02   WG21  
P0226R0 Mathematical Special Functions for C++17, v4 Walter E. Brown, Axel Naumann, Edward Smith-Rowland 2016-02-10 2016-02 N4437 Library, Library Evolution  
P0227R0 Weakening the iterator categories of some standard algorithms Thibaut Le Jehan 2016-02-09 2016-02   Library Evolution  
P0228R0 A Proposal to Add Safe Integer Types to the Standard Library Technical Report Robert Ramey 2016-02-16 2016-02   Library Evolution  
P0229R0 SG5 Transactional Memory Meeting minutes 2015/11/02-2016/02/08 Michael Wong 2016-02-12 2016-02   Transactional Memory  
P0230R0 SG14 Games Dev/Low Latency/Financial Meeting Minutes 2015/10/14-2015/02/10 Michael Wong 2016-02-12 2016-02   SG14  
P0231R0 Extending the Transactional Memory Technical Specification to Support Commit Actions Victor Luchangco, Michael Spear, Michael Wong 2016-02-12 2016-02   Transactional Memory  
P0232R0 A Concurrency ToolKit for Structured Deferral/Optimistic Speculation Paul McKenney, Michael Wong, Maged Michael 2016-02-12 2016-02   Concurrency, SG14, Evolution  
P0233R0 Hazard Pointers: Safe Reclamation for Optimistic Concurrency Maged M. Michael, Michael Wong 2016-02-12 2016-02   Concurrency, SG14, Library Evolution  
P0234R0 Towards Massive Parallelism(aka Heterogeneous Devices/Accelerators/GPGPU) support in C++ Michael Wong, Hartmut Kaiser, Thomas Heller 2016-02-12 2016-02   Concurrency, SG14, Evolution  
P0235R0 A Packaging System for C++ Guy Somberg, Brian Fitzgerald 2016-02-05 2016-02   Evolution, SG14  
P0236R0 Khronos's OpenCL SYCL to support Heterogeneous Devices for C++ Michael Wong, Andrew Richards, Maria Rovatsou, Ruyman Reyes 2016-02-12 2016-02   Concurrency, SG14  
P0237R0 On the standardization of fundamental bit manipulation utilities Vincent Reverdy, Robert J. Brunner 2016-02-12 2016-02   Library Evolution, SG14  
P0238R0 Return type deduction and SFINAE Tomasz Kamińsk 2016-02-07 2016-02   Evolution  
P0239R0 valueless_by_exception Tony Van Eerd 2015-11-12 2016-02   Library Evolution  
P0240R0 Why I want Concepts, but why they should come later rather than sooner Matt Calabrese 2016-02-12 2016-02   WG21  
P0241R0 Remove Future-Related Explicit Specializations for Void Matt Calabrese 2016-02-11 2016-02   Library Evolution  
P0242R0 Standard Library Support For Void Matt Calabrese 2016-02-11 2016-02   Library Evolution  
P0244R0 Text_view: A C++ concepts and range based character encoding and code point enumeration library Tom Honermann 2016-02-10 2016-02   Library Evolution  
P0245R0 Hexadecimal float literals for C++ Thomas Koeppe 2016-02-09 2016-02   Evolution  
P0246R0 Contract Assert Support Merged Proposal Nathan Myers 2016-02-12 2016-02   Evolution  
P0247R0 Criteria for Contract Support Nathan Myers 2016-02-12 2016-02   Evolution  
P0248R0 Concepts in C++17 Andrew Sutton 2016-02-12 2016-02   WG21  
P0249R0 Input Devices For 2D Graphics Brett Searles 2016-02-05 2016-02   SG14  
P0250R0 Wording improvements for initialization and thread ids (CWG 2046) Hans Boehm 2016-02-12 2016-02   Concurrency, Core  
P0251R0 Unified Call Syntax Wording Bjarne Stroustrup, Herb Sutter 2016-02-11 2016-02   Evolution  
P0252R0 Operator Dot Wording Bjarne Stroustrup, Gabriel Dos Reis 2016-02-13 2016-02   Evolution  
P0253R0 Fixing a design mistake in the searchers interface in Library Fundamentals Marshal Clow 2016-02-12 2016-02   Library Evolution  
P0255R0 C++ Static Reflection via template pack expansion Cleiton Santoia Silva, Daniel Auresco 2016-02-12 2016-02 N4447 Reflection  
P0256R0 C++ Reflection Light Cleiton Santoia Silva 2016-02-12 2016-02   Reflection  
P0257R0 A byte type for the standard library. Neil MacIntosh 2016-02-11 2016-02   Library Evolution  
P0258R0 is_contiguous_layout Michael Spencer 2016-02-12 2016-02   Evolution, Library Evolution  
P0259R0 fixed_string: a compile-time string Michael Price, Andrew Tomazos 2016-02-12 2016-02   Library Evolution  
P0260R0 C++ Concurrent Queues Lawrence Crowl, Chris Mysen 2016-02-14 2016-02   Concurrency  
P0261R0 C++ Distributed Counters Lawrence Crowl 2016-02-14 2016-02   Concurrency  
P0262R0 A Class for Status and Optional Value Lawrence Crowl 2016-02-14 2016-02   Evolution  
P0263R0 Core Language Working Group "tentatively ready" Issues for the February, 2016 (Jacksonville) Meeting William M. Miller 2016-02-15 2016-02   Core  
P0264R0 auto operator= considered dangerous Michael Price 2016-02-11 2016-02   Evolution  
P0265R0 SG5 is NOT proposing Transactional Memory for C++17 Michael Wong 2016-02-15 2016-02   Transactional Memory  
P0266R0 Removing Restrictions on requires-Expressions Walter E. Brown 2016-02-12 2016-02   Evolution  
P0267R0 A Proposal to Add 2D Graphics Rendering and Display to C++, Michael McLaughlin 2016-02-12 2016-02 N4073 SG14  
P0268R0 up-to expression Mike Spertus, Andrew Tomazos 2016-02-12 2016-02   Evolution  
P0269R0 Allocator-aware regular expressions Mike Spertus 2016-02-14 2016-02 N4245 Library  
P0270R0 Removing C dependencies from signal handler wording Hans Boehm 2016-02-12 2016-02   Concurrency  
P0271R0 std::direct_init<T> for plugging the metaprogramming constructor hole Richard Smith, Tony Van Eerd, David Sankel 2016-02-13 2016-02   Library Evolution  
P0272R0 Give 'std::string' a non-const '.data()' member function David Sankel 2016-02-13 2016-02   Library Evolution  
P0273R0 Proposed modules changes from implementation and deployment experience Richard Smith, Chandler Carruth, David Jones 2016-02-12 2016-02   Evolution  
P0274R0 Clump - A Vector-like Sequence Container with Embedded Storage Nevin Liber 2016-02-12 2016-02   Library Evolution  
P0277R0 const Inheritance David Wilson 2016-02-13 2016-02   Evolution  
P0278R0 volatile solutions Jon Kalb, Dan Saks 2016-02-14 2016-02   Core  
P0279R0 Read-Copy Update (RCU) for C++ Paul E. McKenney 2016-02-14 2016-02   Concurrency  
P0280R0 Initialize unspecified aggregate members with direct list initialization James Touton 2016-02-08 2016-02   Evolution  
P0281R0 Remove comma elision in variadic function declarations James Touton 2016-01-23 2016-02   Evolution  
P0282R0 Const-preserving overloads for the strtox family of functions James Touton 2016-02-07 2016-02   Library Evolution, Library  
P0283R0 Standard and non-standard attributes J. Daniel Garcia 2016-02-12 2016-02   Evolution  
P0284R0 Unqualified enumerators in case labels James Touton 2016-02-14 2016-02   Evolution  
P0285R0 Using customization points to unify executors Christopher Kohlhoff 2016-02-14 2016-02   Concurrency  
P0286R0 A networking library extension to support co_await-based coroutines Christopher Kohlhoff 2016-02-14 2016-02   Library Evolution  
P0287R0 Simple Contracts for C++ Gabriel Dos Reis 2016-02-15 2016-02   Evolution  
P0288R0 A polymorphic wrapper for all Callable objects David Krauss 2016-02-13 2016-02   Library Evolution  
P0289R0 Forward declarations of nested classes Matt Austern 2016-02-16 2016-02   Evolution  

 

A bit of background for the unified call proposal

C++ provides two calling syntaxes, x.f(y) and f(x,y). This has bothered me for a long time. I discussed the problem in the context of multimethods in D&E in 1994, referring back to a proposal by Doug Lea from 1991, and again in 2007. Each of the syntaxes has its virtues, but they force design decisions on people, especially library designers. When you write a library, which syntax do you use for operations on objects passed to you by your users? The STL insists on the traditional functional syntax, f(x,y), whereas many OO libraries insist on the dot notation, x.f(y). In turn, libraries force these decisions on their users.


Interestingly, I solved the problems for operators: x+y doesn’t care whether you provide operator+(T,T) or T::operator+(T). The problem is getting more noticeable as we get more generic libraries. Note begin(c) and c.begin() for range-for loops and in general code. Why do we/someone have to write both? If c.begin() exists, begin(c) should find it, just as x+y finds the right implementation. Such call-syntax adapters are pure overhead and different people’s adapters can clash.


In early 2014, Herb Sutter and I each independently decided to propose a unified syntax. Herb suggested unification based on allowing x.f(y) to find a non-member function, giving preference to the x.f(y) syntax, whereas my ideal was that x.f(y) and f(x,y) should mean exactly the same. After a quick discussion, we joined forces. Based on real input from code and users, I reluctantly agreed that for compatibility reasons, x.f(y) and f(x,y) could not mean exactly the same. The only feasible way forward was to do a traditional lookup based on the syntax used, and then try the other syntax if the first one failed. Stability – backwards compatibility – is an important feature, overruling my desire for perfection.


To my surprise, many people came out strongly against x.f(y) finding f(x,y) – even if member functions were preferred over free-standing functions by the lookup rules. I received email accusing me of “selling out to the OO crowd” and people whose experience and opinion I respect insisted that x.f(y) finding f(x,y) would seriously compromise their ability to design stable interfaces. I think those fears are greatly exaggerated, but I could be wrong. Also, I prefer the dot syntax in some cases; for example, I find x.f(y).g(z) more readable than g(f(x,y),z). However, there was no chance of acceptance of a proposal that included x.f(y) finding f(x,y). Maybe modules will eventually help here. Furthermore, David Vandevoorde pointed out that because of the two-phase lookup rules having x.f(y) find f(x,y) would complicate the task for compiler writers and possibly be expensive in compile time.


So, we are left with a simple proposal to allow f(x,y) to find x.f(y) where f(x,y) wouldn’t work today. This solves the problem for library writers and their users along the lines of the STL:

  • Library designers don’t have to force users to use one preferred syntax or to duplicate the implementation to handle both.
  • It allows us to write simple concepts for new libraries.
  • We no longer have to write call-syntax adapters.
  • We can in many cases add functionality to an abstraction without modifying a class
  • We no longer have to bother the users with the distinction between member functions and helper functions.

The proposal was approved by the Evolution Working Group. Faisal Vali did an experimental implementation in Clang. Now we just have to hope that we can agree on exact wording in time for C++17. I consider it a small proposal that will significantly simplify the way we design and use libraries.

New papers: Iterator facade for ranges; adopt File System TS for C++17; unified call syntax wording

Note: This is the last batch of individually- or small-group-posted papers this week. Tomorrow is the pre-Jacksonville paper mailing deadline, so we expect a bunch of papers to come in all at once, and instead of blogging about them individually, those will all advertised here next week as part of the mailing blog post.

 

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.

 

P0186R0: Iterator Facade Library Proposal for Ranges (Beman Dawes, Eric Niebler, Casey Carter)

Proposes a library component for easily creating conforming iterators. Based on existing practice. Depends only on the C++17 working paper plus Concepts TS and Ranges TS. Breaks no existing code or ABI's. Two open-source implementations including test suites available. Proposed wording provided.

 

P0218R0: Adopt the File System TS for C++17 (Beman Dawes)

Technical work on N4100, File System Technical Specification, ISO/IEC TS 18822:2015, was completed in July 2014, and published by ISO in July 2015. There are three shipping implementations and one soon-to-ship implementation. Two of the shipping implementations have been have been in use for several years. This document proposes adopting the File System Technical Specification, with corrections, for C++17. The alternative to this proposal is to start work on version two of the File System TS. Doing nothing is not an alternative.

 

P0251R0: Unified Call Syntax Wording (Bjarne Stroustrup, Herb Sutter)

This is the proposed wording for a unified call syntax based on the idea that f(x,y) can invoke a member function, x.f(y), if there are no f(x,y). The inverse transformation, from x.f(y) to f(x,y) is not proposed. [...] As agreed in EWG at the Kona meeting, the intent of the wording is: For f(x,y), see if f(x,y) is valid and if so do that call; otherwise try x.f(y).

 

A bit of background for the structures bindings proposal

[This note from Bjarne provides some background for the updated structured bindings proposal posted yesterday. --Ed.]

 

In the context of the C++ Core Guidelines, we (Herb Sutter, Gabriel Dos Reis, me, and few others) were discussing sources of bugs and inefficiencies. We noticed that returning multiple values (e.g., from a tuple) was one of the two remaining sources of uninitialized variables. We noticed that there were real cases of bugs and inefficiency (from default initialization followed by assignment rather than initialization) stemming from separating variable introduction from initialization. Use of tie() is at best a partial solution that doesn’t get to the root of the problem.

The next day or so, Herb had a first draft of a proposal. We refined it, adding use cases and implications. I noted that we had a syntax in concepts for the introduction of multiple names that we could borrow. We noted that whatever we came up with had to fit into our ideas for a possible future far-more-general pattern matching design. We always try to ensure that a proposal doesn’t block an important potential evolution path. The design document for the proposal was refined and extended.

It was now obvious that the proposal completed C++’s mechanism for returning multiple values from a function: With structured binding, we can initialize a set of values, {x,y,z},  just as we  can return a set of values, {e1,e2,e3}.

In web discussions, and especially at the Kona standards meeting, many alternatives were discussed. We focused on how to deal with user-defined types with private members. The new feature mustn’t discourage encapsulation by providing a convenient notation for structs only. We also considered whether explicit declaration of types were needed and how to achieve conversions. A conversion from a char[] in a return value to a string was considered particularly desirable by several people. These two needs were both addressed by adding the ability for users to define get<N> functions for a class. Jens Maurer refined the proposed wording and in doing so found a few weaknesses in the design.

For the details and code examples, you can find the current proposal and wording papers here for the upcoming meeting in Jacksonville.

P0144R1 and P0217R0: Structured bindings (Sutter, Stroustrup, Dos Reis) and wording (Maurer)

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.

 

P0144R1: Structured bindings (Herb Sutter, Bjarne Stroustrup, Gabriel Dos Reis)

This paper proposes the ability to declare multiple variables initialized from a tuple or struct, along the lines of:

tuple f(/*...*/) { /*...*/ return {a,b,c}; } 

auto {x,y,z} = f(); // x has type T1, y has type T2, z has type T3 

This addresses the requests for support of returning multiple values, which has become a popular request lately.

Proposed wording appears in a separate paper, P0217.

 

P0217R0: Proposed wording for structured bindings (Jens Maurer)

This paper presents the proposed wording to implement structured bindings as described by Herb Sutter, Bjarne Stroustrup, and Gabriel dos Reis in P0144R1.

 

P0221R0: Proposed wording for default comparisons, revision 2 -- Jens Maurer

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

Document number: P0221R0

Date: 2016-02-10

Proposed wording for default comparisons, revision 2

by Jens Maurer

Excerpt:

This paper presents design rationale and proposed wording to implement default comparisons for class types. It is a revision of N4532 with additional updates from the Evolution Working Group session at the Kona meeting of WG21 and in-depth discussions with interested parties. Blue text in the proposed wording indicates changes compared to N4532.

This paper assumes that the reader is familar with N4475 "Default comparisons (R2)" by Bjarne Stroustrup. In particular, default comparisons are assumed to be implicit (i.e. require no extra syntax to be available).