February 2017

Quick Q: why there is no data-race in the following case?

Quick A: No write is triggered so no data race occurs.

Recently on SO:

why there is no data-race in the following case?

Data races are not static properties of your code. They are properties of the actual state of the program at execution time. So while that program could be in a state where the code would produce a data race, that's not the question.

The question is, given the state of the system, will the code cause a data race? And since the program is in a state such that neither thread will write to either variable, then the code will not cause a data race.

Data races aren't about what your code might do. It's about what they will do. Just as a function that takes a pointer isn't undefined behavior just because it uses the pointer without checking for NULL. It is only UB if someone passes a pointer that really is NULL.

C++ Weekly Episode 50: Inheriting Lambdas vs Generic Lambdas—Jason Turner

Episode 50 of C++ Weekly.

Inheriting Lambdas vs Generic Lambdas

by Jason Turner

About the show:

The last episode of C++ Weekly showed why and where we might want to inherit from lambdas and create a merged lambda with the signatures of two or more other lambdas. In this episode Jason compares a merged lambda with a generic lambda and what the pros and cons might be.

2017-02 pre-Kona mailing available

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

NOTE: Some of these papers have already been posted via this blog. This is the complete list including ones not previously publicized.


WG21 Number Title Author Document Date Mailing Date Previous Version Subgroup Disposition
SD-1 2017 PL22.16/WG21 document list John Spicer 2017-02-08 2017-02      
2017-02 pre-Kona
N4632 PL22.16/WG21 draft agenda: 27 Feb - 4 Mar 2017, Kona, HI, US Clark Nelson 2016-12-13 2017-02   WG21  
N4633 2017-11 Albuquerque WG21 meeting information Carter Edwards 2017-01-09 2017-02   WG21  
N4634 PL22.16 2016-11 Issaquah Minutes (final) Jonathan Wakely 2017-01-18 2017-02   WG21  
N4635 Pre-Kona WG21 Telecon Agenda Herb Sutter 2017-01-23 2017-02   WG21  
N4636 2017-07-10-15 ISO WG21 C++ Standard Meeting in Toronto Michael Wong, Botond Ballo, JF Bastien, Hubert Tong, Patrice Roy, Tony Van Eerd, Duncan Exon Smith 2017-02-06 2017-02   WG21  
N4637 Working Draft, Extensions to C++ for Modules Gabriel Dos Reis 2017-02-03 2017-02 N4610 WG21  
N4638 Editor's Report for the Module TS Gabriel Dos Reis 2017-02-03 2017-02   WG21  
N4639 Editor's Report -- Working Draft, Standard for Programming Language C++ Richard Smith 2017-02-06 2017-02   WG21  
N4640 Working Draft, Standard for Programming Language C++ Richard Smith 2017-02-06 2017-02 N4618 WG21  
N4641 Working Draft, C++ extensions for Concepts Andrew Sutton 2017-02-05 2017-02 N4630 WG21  
N4642 Editor's report for the Concepts TS Andrew Sutton 2017-02-05 2017-02   WG21  
P0045R1 Qualified std::function signatures David Krauss 2017-02-06 2017-02 P0045R0 Library Evolution  
P0052R3 Generic Scope Guard and RAII Wrapper for the Standard Library Peter Sommerlad, Andrew L. Sandoval 2017-02-06 2017-02 P0052R2 Library  
P0059R3 A proposal to add a ring span to the standard library Guy Davidson, Arthur O'Dwyer 2017-02-05 2017-02 P0059R2 SG14, Library Evolution  
P0082R2 For Loop Exit Strategies (Revision 3) Alan Talbot 2017-02-06 2017-02 P0082R1 Evolution  
P0091R4 Template argument deduction for class templates (Rev. 7) Mike Spertus, Faisal Vali, Richard Smith 2016-06-24 2017-02 P0091R3 Evolution  
P0103R1 Overflow-Detecting and Double-Wide Arithmetic Operations Lawrence Crowl 2017-02-05 2017-02 P0103R0 Numerics  
P0104R1 Multi-Word Integer Operations and Types Lawrence Crowl 2017-02-05 2017-02 P0104R0 Numerics  
P0105R1 Rounding and Overflow in C++ Lawrence Crowl 2017-02-05 2017-02 P0105R0 Numerics  
P0122R4 span: bounds-safe views for sequences of objects Neil MacIntosh 2017-02-06 2017-02 P0122R3 Library  
P0165R4 C++ Standard Library Issues to be moved in Issaquah Marshall Clow 2017-02-06 2017-02 P0165R3 Library  
P0190R3 Proposal for New memory order consume Definition Paul E. McKenney, Michael Wong, Hans Boehm, Jens Maurer, Jeffrey Yasskin, JF Bastien 2017-02-05 2017-02 P0190R2 Concurrency  
P0194R3 Static reflection Matúš Chochlík, Axel Naumann, David Sankel 2017-02-06 2017-02 P0194R2 Reflection, Evolution  
P0214R3 Data-Parallel Vector Types & Operations Matthias Kretz 2017-02-06 2017-02 P0214R2 Library Evolution  
P0233R3 Hazard Pointers: Safe Reclamation for Optimistic Concurrency Maged M. Michael, Michael Wong, Paul McKenney, Arthur O'Dwyer, David Hollman 2017-02-06 2017-02 P0233R2 Concurrency, SG14, Library Evolution  
P0237R5 Wording for fundamental bit manipulation utilities Vincent Reverdy, Robert J. Brunner 2017-02-06 2017-02 P0237R4 Library Evolution, SG14, Numerics  
P0260R1 C++ Concurrent Queues Lawrence Crowl 2017-02-05 2017-02 P0260R0 Concurrency  
P0261R2 C++ Distributed Counters Lawrence Crowl 2017-02-05 2017-02 P0261R1 Concurrency  
P0267R3 A Proposal to Add 2D Graphics Rendering and Display to C++, Michael McLaughlin, Herb Sutter, Jason Zink 2017-02-06 2017-02 P0267R2 Library Evolution  
P0275R1 A Proposal to add Classes and Functions Required for Dynamic Library Load Antony Polukhin 2017-01-28 2017-02 P0275R0 Library Evolution  
P0288R1 A polymorphic wrapper for all Callable objects David Krauss 2017-02-06 2017-02 P0288R0 Library Evolution  
P0316R0 allocate_unique and allocator_delete Miro Knejp 2017-02-01 2017-02   Library Evolution  
P0339R2 polymorphic_allocator<void> as a vocabulary type Pablo Halpern, Dietmar Kühl 2017-02-04 2017-02 P0339R1 Library Evolution  
P0352R1 Smart References through Delegation (2nd revision) Hubert Tong, Faisal Vali 2017-02-06 2017-02 P0352R0 Evolution  
P0355R2 Extending <chrono> to Calendars and Time Zones Howard Hinnant 2017-02-04 2017-02 P0355R1 Library Evolution  
P0385R2 Static reflection: Rationale, design and evolution Matúš Chochlík, Axel Naumann, David Sankel 2017-02-06 2017-02 P0385R1 Reflection, Evolution  
P0408R1 Efficient Access to basic stringbuf's Buffer Peter Sommerlad 2017-02-03 2017-02 P0408R0 Library Evolution, Library  
P0433R1 Toward a resolution of US7 and US14: Integrating template deduction for class templates into the standard library Mike Spertus, Walter E. Brown 2017-02-06 2017-02 P0433R0 Library Evolution, Library  
P0443R1 A Unified Executors Proposal for C++ Jared Hoberock, Michael Garland, Chris Kohlhoff, Chris Mysen, Carter Edwards, Gordon Brown 2017-01-06 2017-02 P0443R0 Concurrency  
P0447R1 Introduction of std::colony to the standard library Patrice Roy, Guy Davidson, Matthew Bentley 2016-11-21 2017-02 P0443R0 Library Evolution, SG14  
P0461R1 Proposed RCU C++ API Paul E. McKenney, Maged Michael, Michael Wong, Isabella Muerte, Arthur O'Dwyer, David Hollman 2017-02-05 2017-02 P0461R0 Concurrency  
P0462R1 Marking memory order consume Dependency Chains Paul E. McKenney, Torvald Riegel, Jeff Preshing, Hans Boehm, Clark Nelson, Olivier Giroux, Lawrence Crowl, JF Bastien, Micheal Wong 2017-02-05 2017-02 P0462R0 Concurrency  
P0467R1 Iterator Concerns for Parallel Algorithms Alisdair Meredith 2016-11-10 2017-02 P0467R0 Concurrency, Library  
P0479R1 Attributes for Likely and Unlikely Branches Clay Trychta 2017-02-05 2017-02 P0479R0 Evolution, SG14  
P0492R1 Proposed Resolution of C++17 National Body Comments for Filesystem Beman Dawes, S. Davis Herring, Nicolai Josuttis, Jason Liu, Billy O'Neal, P.J. Plauger, Jonathan Wakely 2017-02-06 2017-02 P0492R0 Library  
P0501R0 C++ Module TS Issues List Gabriel Dos Reis 2017-02-06 2017-02   Core  
P0506R0 use string_view for library function parameters instead of const string & / const char * Peter Sommerlad 2017-02-04 2017-02   Library, Library Evolution  
P0515R0 Consistent comparison Herb Sutter 2017-02-05 2017-02   Evolution, Library Evolution  
P0518R0 Allowing copies as arguments to function objects given to parallel algorithms in response to CH11 David S. Hollman, Jonathan Liffander, Michael Wong, Detlef Vollmann 2017-01-31 2017-02   Concurrency  
P0527R0 Implicitly move from rvalue references in return statements David Stone 2017-02-05 2017-02   Evolution  
P0532R0 On std::launder() Nico Josuttis 2017-01-14 2017-02   Core, Evolution, Library Evolution, Library  
P0533R0 constexpr for <cmath> and <cstdlib> Edward J. Rosten / Oliver J. Rosten 2017-01-25 2017-02   SG6, Library Evolution  
P0534R0 call/cc (call-with-current-continuation): A low-level API for stackful context switching Oliver Kowalke 2017-02-04 2017-02   Concurrency, Library Evolution  
P0535R0 Generalized Unpacking and Parameter Pack Slicing Matthew Woehlke 2017-02-03 2017-02   Evolution  
P0536R0 Implicit Return Type and Allowing Anonymous Types as Return Values Matthew Woehlke 2017-02-03 2017-02   Evolution  
P0537R0 Allow Attributes on Template Explicit Instantiations Matthew Woehlke 2016-08-23 2017-02   Evolution  
P0538R0 A Qualified Replacement for #pragma once Matthew Woehlke 2016-10-27 2017-02   Evolution  
P0539R0 Wide Integer Class Antony Polukhin 2017-01-28 2017-02   Numerics  
P0540R0 A Proposal to Add split/join of string/string_view to the Standard Library Laurent Navarro 2017-01-21 2017-02   Library Evolution  
P0541R0 Post-Increment on Input and Output Iterators Eric Niebler 2017-02-02 2017-02   Library Evolution  
P0542R0 Support for contract based programming in C++ J. Daniel Garcia 2017-02-05 2017-02   Evolution, Core  
P0543R0 Saturation arithmetic Jens Maurer 2017-01-03 2017-02   Numerics, Library Evolution  
P0544R0 User Injection of Filesystems Titus Winters, Geoffrey Romer 2017-02-01 2017-02   Library Evolution  
P0545R0 Supporting offsetof for Stable-layout Classes Andrey Semashev 2016-10-23 2017-02   Library Evolution, Library  
P0546R0 Span - foundation for the future Carter Edwards, Bryce Lelbach 2017-01-26 2017-02   Library Evolution  
P0547R0 Assorted Object Concept Fixes Eric Niebler 2017-02-02 2017-02   Library  
P0548R0 common_type and duration Walter E. Brown 2017-02-01 2017-02   Library  
P0549R0 Adjuncts to std::hash Walter E. Brown 2017-02-01 2017-02   Library Evolution  
P0550R0 Transformation Trait uncvref Walter E. Brown 2017-02-01 2017-02   Library Evolution  
P0551R0 Thou Shalt Not Specialize std Function Templates! Walter E. Brown 2017-02-01 2017-02   Library Evolution  
P0552R0 enable_if vs. requires Walter E. Brown 2017-02-01 2017-02   WG21  
P0553R0 Bit Operations Jens Maurer 2017-02-05 2017-02   Numerics, Library Evolution  
P0554R0 Composition of Arithmetic Types John McFarlane 2017-02-06 2017-02   Numerics, SG14  
P0555R0 string_view for source_location Axel Naumann 2017-01-30 2017-02   Library Evolution  
P0556R0 Integral power-of-2 operations Jens Maurer 2017-02-05 2017-02   Numerics, Library Evolution  
P0557R0 Concepts: The Future of Generic Programming Bjarne Stroustrup 2017-01-31 2017-02   WG21  
P0558R0 Resolving atomic<T> named base class inconsistencies Billy O'Neal 2017-02-03 2017-02   Concurrency, Library  
P0559R0 Operating principles for evolving C++ JC van Winkel, Jose Daniel Garcia, Ville Voutilainen, Roger Orr, Michael Wong, Sylvain Bonnal 2017-01-31 2017-02   WG21  
P0560R0 Class template deduction guides for "diamond operators" Miro Knejp 2017-02-01 2017-02   Library Evolution  
P0561R0 RAII Interface for Deferred Reclamation Geoffrey Romer 2017-02-03 2017-02   Concurrency  
P0562R0 Initialization List Symmetry Alan Talbot 2017-02-05 2017-02   Evolution  
P0563R0 Vector Front Operations Alan Talbot 2017-02-05 2017-02   Library Evolution  
P0564R0 Wording for three-way comparisons Jens Maurer 2017-02-06 2017-02   Evolution  
P0565R0 Prefix for operator as a pack generator and postfix operator[] for pack indexing Bengt Gustafsson 2017-02-02 2017-02   Evolution  
P0566R0 Proposed Wording for Concurrent Data Structures: Hazard Pointer and Read-Copy-Update (RCU) Michael Wong, Maged M. Michael, Paul McKenney 2017-02-06 2017-02   Concurrency, SG14, Library Evolution, Library  
P0567R0 Asynchronous managed pointer for Heterogeneous computing Gordon Brown, Ruyman Reyes, Michael Wong 2017-01-30 2017-02   Concurrency, SG14  
P0568R0 Towards Better Embedded programming support for C++ and an update on the status of SG14, two years later.Towards Better Embedded programming support for C++ and an update on the status of SG14, two years later Michael Wong 2017-02-06 2017-02   SG14, WG21  
P0569R0 SG5: Transactional Memory (TM) Meeting Minutes 2016/07/18-2016/10/10 Michael Wong 2017-02-06 2017-02   SG5  
P0570R0 SG14: Low Latency Meeting Minutes 2016/12/14-2017/02/01 Michael Wong 2017-02-06 2017-02   SG14  
P0571R0 Type Requirements for <numeric> Algorithms Bryce Adelstein Lelbach 2017-02-02 2017-02   Concurrency, Library Evolution, Library  
P0572R0 bit_sizeof and bit_offsetof Alex Christensen 2017-02-03 2017-02   Evolution  
P0573R0 Abbreviated Lambdas for Fun and Profit Barry Revzin 2017-02-03 2017-02   Evolution  
P0574R0 Algorithm Complexity Constraints and Parallel Overloads Anthony Williams 2017-02-04 2017-02   Concurrency, Library  
P0575R0 Core Language Working Group "ready" Issues for the February, 2016 (Kona) meeting William M. Miller 2017-02-06 2017-02   Core  
P0576R0 Core Language Working Group "tentatively ready" Issues for the February, 2016 (Kona) meeting William M. Miller 2017-02-06 2017-02   Core  
P0577R0 Keep that Temporary! Zhihao Yuan 2017-02-02 2017-02   Evolution  
P0578R0 Static Reflection in a Nutshell Matúš Chochlík, Axel Naumann, David Sankel 2017-02-04 2017-02   Evolution, Library Evolution  
P0579R0 Constexpr for <experimental/ranges/iterator> Casey Carter 2017-01-23 2017-02   Library  
P0581R0 Standard Library Modules Gabriel Dos Reis, Billy O'Neal, Stephan T. Lavavej, Jonathan Wakely 2017-02-06 2017-02   Evolution, Library Evolution  
P0583R0 std::byte is the correct name Gabriel Dos Reis 2017-02-04 2017-02   WG21  
P0587R0 Concepts TS revisited Richard Smith, James Dennett 2017-02-05 2017-02   Evolution  
P0588R0 Simplifying implicit lambda capture Richard Smith, Daveed Vandevoorde 2017-02-05 2017-02   Evolution  
P0589R0 Tuple-based for loops Andrew Sutton 2017-02-04 2017-02   Evolution  
P0590R0 A design static reflection Andrew Sutton, Herb Sutter 2017-02-05 2017-02   Reflection  
P0591R0 Utility functions to implement uses-allocator construction Pablo Halpern 2017-02-05 2017-02   Library Evolution  
P0592R0 To boldly suggest an overall plan for C++20 Ville Voutilainen 2017-02-05 2017-02   WG21  
P0593R0 What to do with buffers that are not arrays, and undefined behavior thereof? Ville Voutilainen 2017-02-05 2017-02   WG21  
P0594R0 Relative comparisons and std::less<T*> Ville Voutilainen 2017-02-05 2017-02   WG21  
P0595R0 The "constexpr" Operator Daveed Vandevoorde 2017-02-02 2017-02   Evolution  
P0596R0 std::constexpr_trace and std::constexpr_assert Daveed Vandevoorde 2017-02-02 2017-02   Evolution  
P0597R0 std::constexpr_vector<T> Daveed Vandevoorde 2017-02-02 2017-02   Evolution  
P0598R0 Reflect Through Values Instead of Types Daveed Vandevoorde 2017-02-02 2017-02   Reflection, Evolution  
P0599R0 US140: noxecept for hash functions Nicolai Josutti 2017-01-14 2017-02   Library  
P0600R0 applying [[nodiscard]] for C++17 Nicolai Josutti 2017-02-06 2017-02   Library Evolution, Library  
P0601R0 Establishing a direction for SIMD-enabled functions Clark Nelson 2017-02-06 2017-02   Concurrency, Evolution  


CppCast Episode 88: Microsoft's STL with Stephan T. Lavavej

Episode 88 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Stephan T. Lavavej to talk about Microsoft's STL and some of the changes to the Library coming in the VS 2017 release.

CppCast Episode 88: Microsoft's STL with Stephan T. Lavavej

by Rob Irving and Jason Turner

About the interviewee:

Stephan T. Lavavej is a Principal Software Engineer at Microsoft, maintaining Visual C++'s implementation of the C++ Standard Library since 2007. He also designed a couple of C++14 features: make_unique and the transparent operator functors. He likes his initials (which people can actually spell) and cats (although he doesn't own any).

Using QtCreator together with the Visual Studio Build Tools

A first posting about working with Qt and Visual C++ in QtCreator

Using QtCreator together with the Visual Studio Build Tools

by Jens Weller

From the article:

For a while I've been using QtCreator as my IDE, mostly because its deep integration with Qt, as most of my projects are Qt related. With this, I also preferred (and still do a little) to use the MinGW builds of Qt on Windows. In the past, as GCC was a little bit better with the newer standards, today, well, never change a running system...

Dependencies in the Gang of Four examples—Zebedee Mason

Zebedee Mason discusses in his recent article some GOF idioms and analyzes them with his tool DeepsEnds.

Dependencies in the Gang of Four examples

by Zebedee Mason

From the article:

The example C++ code from the GoF (Gang of Four) book Design Patterns has had its dependencies analysed with DeepEnds. Certain examples have been refactored to remove circular dependencies enabled by pre-declaration of classes. These cycles in the graph serve to reduce the ability to subsequently modify the code with ease.

Fold Expressions—Rainer Grimm

Do you know how they work?

Fold Expressions

by Rainer Grimm

From the article:

With fold expressions you can implement the from Haskell known functions foldl, foldr, foldl1 and foldr1 directly in C++. These four functions successively reduce a list to a single value...

Un-Deprecate Your Qt Project—Giuseppe D'Angelo

Giuseppe D'Angelo explains how the Qt project deprecates APIs, a challenge every library project faces.

Un-Deprecate Your Qt Project

by Giuseppe D'Angelo

From the article:

Any product needs to evolve if it wants to remain competitive. If the development bandwidth is finite, from time to time there is the need to drop some ballast. This does not necessarily mean dropping working functionality and leaving users in the cold. At least in Qt most of the time this actually means replacing working functionality with better working functionality.

This process has being going on in Qt since forever, but since Qt 5.0 we’ve started to formalize it in terms of documentation hints and macros in the source code. This was done with a precise purpose: we wanted Qt users to discover if they were using deprecated APIs, and if so, let them know what better alternatives were available.

And since the very release of Qt 5.0.0 we’ve officially deprecated hundreds of APIs: a quick grep in QtBase alone reveals over 230 hits (mostly functions, but also entire classes).