Articles & Books

Overload 140 is now available

ACCU’s Overload journal of June 2017 is out. It contains the following C++ related articles.

Overload 140 is now available

From the journal:

Editorial: Gnomes and Misnomers.
What's in a name? Frances Buontempo decides some names are better than others.

The Path of the Programmer.
Charles Tolman provides a framework for personal development.

A Usable C++ Dialect that is Safe Against Memory Corruption.
Sergey Ignatchenko continues his investigation of allocators for (Re)Actors.

Metaclasses: Thoughts on Generative C++.
Herb Sutter shows how metaclasses could simplify C++ with minimal library extension.

A C++ Developer Sees Rustlang for the First Time.
Katarzyna Macias provides an introduction to Rust for a C++ developer.

Portable Console I/O via iostreams.
Alf Steinbach describes how his library fixes problems streaming non-ASCII characters in Windows.

A Functional Alternative to Dependency Injection in C++.
Satprem Pamudurthy showcases a functional alternative to dependency injection in C++.

About the C++ Core Guidelines.
Andreas Fertig shows us the C++ core guidelines.

Afterwood.
Chris Oldwood reminds us to fix the problem, not to blame.

Quick Q: Make C++ fail compilation on specific instantiation of template function

Quick Q: Delete its constructor

Recently on SO:

Make C++ fail compilation on specific instantiation of template function

Since foo is a complete specialization, it will always get compiled, and the static assert will always get called.

However, there’s an easier way:

template <>
Bar foo<Bar>(Bar val) = delete;

This will say that this specific version is deleted, and cannot be called.

Ranges, Coroutines, and React: Early Musings on the Future of Async in C++ -- Eric Niebler

Eric Niebler shares his thoughts about the interaction of ranges and co-routines in his recent blog post.

Ranges, Coroutines, and React: Early Musings on the Future of Async in C++

by Eric Niebler

From the article:

Another way to look at this is that synchronous ranges are an example of a pull-based interface: the user extracts elements from the range and processes them one at a time. Asynchronous ranges, on the other hand, represent more of a push-based model: things happen when data shows up, whenever that may be. This is akin to the reactive style of programming.

By using ranges and coroutines together, we unify push and pull based idioms into a consistent, functional style of programming. And that’s going to be important, I think.

Your own error condition--Andrzej KrzemieĊ„ski

The series continues.

Your own error condition

by Andrzej Krzemieński

From the article:

In the previous post we have seen how you can create your own error-code enumeration for representing different reasons for failure in your component, and how you can store them and convey them type erased via std::error_code. In this post we will see how you can inspect an error situation encoded in std::error_code, and how you can build useful queries about error conditions.

Quick Q: Why are static addresses constexpr?

Quick A: Because it is defined at compile time in a special section.

Recently on SO:

A little confused about constexpr functions

If 'x' is declared static, there are no errors. Why?

This is because there is always exactly one x in the program. It has an address (somewhere in the .data segment under normal conditions).

Confusingly, both static and extern keywords specify the storage duration as static (they differ in linkage)

How is it possible to get a variable address during the compilation process? Aren't they allocated at run-time?
Variables with automatic, dynamic or thread storage durations are allocated at runtime. Static duration variables are allocated by the compiler. (The linker and OS can change the location, but they know how to fix all the references when they do)

 

The reviews at r/cpp_review have begun!

Participate in the first two reviews at r/cpp_review:

The reviews have begun

by Jens Weller

From the article

A few weeks ago I announced a C++ review community, which since then has grown to 250+ members on reddit. There has been great feedback and discussions since then, so that the idea is now ready to be tested.  With August, the first review period has started

2017-07 post-Toronto mailing available

The full 2017-07 mailing of new standards papers is now available.

 

2017-07 post-Toronto
N4676 WG21 Telecon Minutes Jonathan Wakely 2017-06-30 2017-07   WG21  
N4677 WG21 / PL22.16 Meeting, Jacksonville, FL, March 12 - 17, 2018 Barry Hedquist 2017-07-07 2017-07   WG21  
N4678 National Body Comments for ISO/IEC PDTS 22277, C++ Extensions for Coroutines Gor Nishanov 2017-07-29 2017-07   WG21  
N4679 Editor's report for the Coroutines TS Gor Nishanov 2017-07-29 2017-07   WG21  
N4680 C++ Extensions for Coroutines TS Document Gor Nishanov 2017-07-30 2017-07   WG21  
N4681 Working Draft, Extensions to C++ for Modules Gabriel Dos Reis 2017-07-14 2017-07   WG21 Adopted 2017-07
N4682 Editor's Report for the Module TS Gabriel Dos Reis 2017-07-31 2017-07   WG21  
N4683 Business Plan and Convener's Report Herb Sutter 2017-07-17 2017-07   WG21  
N4684 Ranges TS Ballot Document Casey Carter 2017-07-31 2017-07   WG21  
N4685 Working Draft, C++ Extensions for Ranges Casey Carter 2017-07-31 2017-07   WG21  
N4686 Editor's Report for the Ranges TS Casey Carter 2017-07-31 2017-07   WG21  
N4687 Working Draft, Standard for Programming Language C++ Note: Richard Smith 2017-07-30 2017-07   WG21  
N4688 Editor's Report -- Working Draft, Standard for Programming Language C++ Richard Smith 2017-07-30 2017-07   WG21  
N4689 Extensions to C++ for Modules Ballot Document Gabriel Dos Reis 2017-07-31 2017-07   WG21  
N4690 2017-07 Toronto Record of Discussion Patrice Roy 2017-08-03 2017-07   WG21  
N4691 WG21 2017-07 Toronto Minutes Patrice Roy 2017-08-03 2017-07   WG21  
N4692 PL22.16 2017-07 Toronto Minutes Jonathan Wakely 2017-08-03 2017-07   WG21  
P0052R5 Generic Scope Guard and RAII Wrapper for the Standard Library Peter Sommerlad, Andrew L. Sandoval 2017-07-13 2017-07 P0052R4 Library  
P0053r6 C++ Synchronized Buffered Ostream Lawrence Crowl, Peter Sommerlad, Nicolai Josuttis, Pablo Halpern 2017-07-15 2017-07 P0053R5 Library Evolution, Library  
P0076R4 Vector and Wavefront Policies Arch Robison, Pablo Halpern, Robert Geva, Clark Nelson, Jens Maurer 2017-07-14 2017-07 P0076R3 Library Evolution, Core Adopted 2017-07
P0096R4 Feature-testing recommendations for C++ Clark Nelson 2017-07-26 2017-07 P0096R3 Feature Testing  
P0124R3 Linux-Kernel Memory Model Paul E. McKenney, Ulrich Weigand, Andrea Parri, Boqun Feng 2017-06-26 2017-07 P0124R2 Concurrency  
P0190R4 Proposal for New memory order consume Definition Paul E. McKenney, Michael Wong, Hans Boehm, Jens Maurer, Jeffrey Yasskin, JF Bastien 2017-07-28 2017-07 P0190R3 Concurrency  
P0214R5 Data-Parallel Vector Types & Operations Matthias Kretz 2017-07-30 2017-07 P0214R4 Library  
P0233R5 Hazard Pointers: Safe Reclamation for Optimistic Concurrency Maged M. Michael, Michael Wong, Paul McKenney, Arthur O'Dwyer, David Hollman, Geoffrey Romer, Andrew Hunter 2017-07-30 2017-07 P0233R4 Concurrency, SG14, Library Evolution  
P0237r8 Wording for fundamental bit manipulation utilities Vincent Reverdy, Robert J. Brunner 2017-07-31 2017-07 P0237r7 Library Evolution  
P0267r6 A Proposal to Add 2D Graphics Rendering and Display to C++, Michael McLaughlin, Herb Sutter, Jason Zink, Guy Davidson 2017-07-30 2017-07 P0267R5 Library Evolution  
P0306R4 Comma elision and comma deletion Thomas Köppe 2017-07-12 2017-07 P0306R3 Core, WG14 Adopted 2017-07
P0329R4 Designated Initialization Wording Tim Shen, Richard Smith 2017-07-12 2017-07 P0329R3 Core  
P0350R1 Integrating simd with parallel algorithms Matthias Kretz 2017-07-30 2017-07 P0350R0 Library Evolution  
P0388R1 Permit conversions to arrays of unknown bound Robert Haberlach 2017-07-15 2017-07 P0388R0 Evolution  
P0428R2 Familiar template syntax for generic lambdas Louis Dionne 2017-07-13 2017-07 P0428R1 Core Adopted 2017-07
P0443R2 A Unified Executors Proposal for C++ Jared Hoberock, Michael Garland, Chris Kohlhoff, Chris Mysen, Carter Edwards, Gordon Brown 2017-07-31 2017-07 P0443R1 Concurrency,  
P0457R1 String Prefix and Suffix Checking Mikhail Maltsev 2017-07-16 2017-07 P0457R0 Library  
P0463R1 endian, Just endian Howard Hinnant 2017-07-13 2017-07 P0463R0 Library Adopted 2017-07
P0534R2 call/cc (call-with-current-continuation): A low-level API for stackful context switching Oliver Kowalke 2017-07-31 2017-07 P0534R1 Library Evolution  
P0541R1 Ranges TS: Post-Increment on Input and Output Iterators Eric Niebler 2017-07-10 2017-07 P0541R0 Library Adopted 2017-07
P0547R2 Ranges TS: Assorted Object Concept Fixes Eric Niebler 2017-07-11 2017-07 P0547R1 Library Adopted 2017-07
P0550R2 Transformation Trait remove_cvref Walter E. Brown 2017-07-17 2017-07 P0550R1 Library  
P0566R2 Proposed Wording for Concurrent Data Structures: Hazard Pointer and Read-Copy-Update (RCU) Michael Wong, Maged M. Michael, Paul McKenney, Geoffrey Romer, Andrew Hunter 2017-07-30 2017-07 P0566R1 Concurrency, SG14, Library Evolution, Library  
P0579R1 Constexpr for <experimental/ranges/iterator> Casey Carter 2017-07-10 2017-07 P0579R0 Library Adopted 2017-07
P0641R1 Resolving Core Issue #1331 (const mismatch with defaulted copy constructor) Daniel Krugler, Botond Ballo 2017-07-24 2017-07 P0641R0 Evolution  
P0643R0 Omnibus paper:Toronto 2017 meeting Michael Wong 2017-06-14 2017-07   WG21  
P0647R1 Floating point value access for std::ratio Peter Sommerlad 2017-07-21 2017-07 P0647R0 Library, Library Evolution, SG6  
P0651R1 Switch the Ranges TS to Use Variable Concepts Eric Niebler 2017-07-10 2017-07 P0651R0 Library Adopted 2017-07
P0653R1 Utility to convert a pointer to a raw pointer Glen Joseph Fernandes 2017-07-21 2017-07 P0653R0 Library Evolution  
P0664R1 Coroutines TS Issues Gor Nishanov 2017-06-18 2017-07 P0664R0 Evolution, Core, Library Adopted 2017-07
P0668R1 Revising the C++ memory model Hans-J. Boehm, Olivier Giroux, Viktor Vafeiades 2017-07-30 2017-07 P0668R0 Concurrency  
P0674R1 Extending make_shared to Support Arrays Peter Dimov, Glen Fernandes 2017-07-12 2017-07 P0674R0 Library Evolution Adopted 2017-07
P0682R1 Repairing elementary string conversions Jens Maurer 2017-07-12 2017-07 P0682R0 Library Adopted 2017-07
P0683R1 Default member initializers for bit-fields Jens Maurer 2017-07-13 2017-07 P0683R0 Evolution, Core Adopted 2017-07
P0696R1 Remove abbreviated functions and template-introduction syntax from the Concepts TS Tom Honermann 2017-07-13 2017-07 P0696R0 Evolution  
P0699R0 C++ Standard Library Issues Resolved Directly In Toronto Marshall Clow 2017-07-14 2017-07   Library Adopted 2017-07
P0702R1 Language support for Constructor Template Argument Deduction Mike Spertus, Jason Merrill 2017-07-14 2017-07 P0702R0 Evolution, Core Adopted 2017-07
P0704R1 Fixing const-qualified pointers to members Barry Revzin 2017-07-10 2017-07 P0704R0 Evolution Adopted 2017-07
P0707R1 Metaclasses: Generative C++ Herb Sutter 2017-07-25 2017-07 P0707R0 SG7  
P0710R1 Core Language Working Group "ready" Issues for the July, 2017 (Toronto) meeting William M. Miller 2017-07-13 2017-07 P0710R0 Core Adopted 2017-07
P0714R0 Identically Named Namespaces and non-Exported Symbols Nathan Sidwell 2017-06-06 2017-07   Evolution, Core  
P0715R0 Exporting Using Directives Nathan Sidwell 2017-06-18 2017-07   Evolution, Core  
P0717R1 Semantic constraint matching for concepts Richard Smith, Andrew Sutton 2017-07-24 2017-07 P0717R0 Posterity  
P0724R0 Merge the Concepts TS Working Draft into the C++20 working draft Ville Voutilainen 2017-06-27 2017-07   WG21  
P0725R0 Remove the requirement for constrained-type-specifiers to be deduced to the same type from the Concepts TS Tom Honermann 2017-07-03 2017-07   Evolution  
P0726R0 Does the Concepts TS Improve on C++17? Duncan P.N. Exon Smith 2017-07-07 2017-07   Evolution  
P0727R0 Core Issue 1299: Temporary objects vs temporary expressions Jens Maurer 2017-07-10 2017-07   Core Adopted 2017-07
P0728R0 Wording for Networking PDTS ballot comment 005 Jonathan Wakely 2017-07-11 2017-07   Networking Adopted 2017-07
P0729R0 Proposed wording for Networking TS NB comment GB 9 Christopher Kohlhoff 2017-07-11 2017-07   Networking Adopted 2017-07
P0730R0 Options for addressing requires-clause syntax ambiguities Hubert S.K. Tong 2017-07-11 2017-07   Evolution  
P0730R1 Options for addressing requires-clause syntax ambiguities Hubert S.K. Tong 2017-07-12 2017-07 P0730R0 Evolution  
P0731R0 Module Interface Imports Nathan Sidwell 2017-07-27 2017-07   Evolution, Core  
P0734R0 Wording Paper, C++ extensions for Concepts Andrew Sutton 2017-07-14 2017-07 N4674 WG21 Adopted 2017-07
P0738R0 I Stream, You Stream, We All Stream for istream_iterator Casey Carter 2017-07-07 2017-07   Library  
P0739R0 Some improvements to class template argument deduction integration into the standard library Mike Spertus, Walter E. Brown, Stephan T. Lavavej 2017-07-13 2017-07   Library Evolution, Library Adopted 2017-07
P0740R0 Ranges TS "Immediate" Issues from the July 2017 (Toronto) meeting Casey Carter 2017-07-14 2017-07   Library Adopted 2017-07
P0742R0 Wording for Networking PDTS ballot comment resolutions Jonathan Wakely 2017-07-14 2017-07   Networking Adopted 2017-07
P0746R0 Wording for Networking PDTS ballot comment 011 (US-10) Jonathan Wakely 2017-07-13 2017-07   Networking Adopted 2017-07
P0747R0 Wording for Networking PDTS ballot comments 026 (GB-15) and 027 (GB-16) Jonathan Wakely 2017-07-14 2017-07   Networking  
P0747R1 Wording for Networking PDTS ballot comment 026 (GB-15), but not 027 (GB-16) Jonathan Wakely 2017-07-14 2017-07 P0747R0 Networking Adopted 2017-07
P0748R0 Wording for Networking PDTS ballot comments on reentrancy Jonathan Wakely 2017-07-14 2017-07   Networking Adopted 2017-07
P0749R0 Namespace Pervasiveness & Modules Nathan Sidwell 2017-07-27 2017-07 P0714R0 Evolution, Core  
P0753R0 Manipulators for C++ Synchronized Buffered Ostream Peter Sommerlad, Pablo Halpern 2017-07-15 2017-07   Library Evolution, Library  
P0754R0 <version> Alan Talbot 2017-07-30 2017-07   Library Evolution  
P0758R0 Implicit conversion traits and utility functions Daniel Krugler 2017-07-30 2017-07   Library Evolution, Library  
P0759R0 fpos Requirements Daniel Krugler 2017-07-28 2017-07   Library  
P0761R0 Executors Design Document Jared Hoberock, Michael Garland, Chris Kohlhoff, Chris Mysen, Carter Edwards, Gordon Brown, Michael Wong 2017-07-31 2017-07   Concurrency  
P0766R0 Fixing small-ish functionality gaps in constraints Ville Voutilainen 2017-07-31 2017-07   Evolution