August 2017

CppCon 2016: Instruction Re-ordering Everywhere: The C++ ‘As-If’ Rule and the Role…—Charles Bay

Have you registered for CppCon 2017 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2016 for you to enjoy. Here is today’s feature:

Instruction Re-ordering Everywhere: The C++ 'As-If' Rule and the Role of Sequence

by Charles Bay

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

This is an introductory (i.e., "First Principles") dive into instruction re-ordering (at compile-time, and at run-time) due to conspiring by the compiler and CPU to make most efficient use of execution units and resources within the CPU processor core. Discussion is made of the role for sequence, for tracing of data flows and control flows, how "out-of-order" execution occurs within the compiler and CPU, and why that's a "good thing". The importance of the C++ "As-If" rule that allows these optimizations is explained.

Exploration is made of imperative versus sequential devices, physical versus logical sequences, and the role of the CPU cache line. At the end of this talk, it will be obvious for how and why instruction re-ordering occurs, and the programmer's need to consider logical dependencies (and not instruction order) when defining algorithms.

This talk is ideal for any programmer confused after observing instruction reordering in their running systems, and provides a solid basis to begin reasoning about how to leverage parallelism and be concerned with concurrency.

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.

CppCon 2016: Regular Expressions in C++, Present and Future—Tim Shen

Have you registered for CppCon 2017 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2016 for you to enjoy. Here is today’s feature:

Regular Expressions in C++, Present and Future

by Tim Shen

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Regular expressions are widely used in application development and data processing, yet it is challenging to design and implement a regular expression library that is expressive, efficient and safe.

In this talk, Tim Shen, the current maintainer of libstdc++'s <regex>, will introduce the basics of implementing regular expressions in C++, the status of existing implementations, and what is expected from the standardization process.

For the implementation, several data structures and algorithms will be introduced, with pros and cons listed; we will show how several popular implementations (Boost.Regex, Boost.Xpressive, <regex> from standard library implementations, RE2, etc) pick their algorithms. Several popular features/patterns that hurt performance will be explained, with a "safe" regex usage suggested. Finally a wishlist of features will be presented, in order to deliver a more efficient and usable regex library.

CppCast Episode 114: Building Debuggers and Keyboards with Simon Brand

Episode 114 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Simon Brand from Codeplay Software to talk about building C++ debuggers and the hardware and C++ firmware of a custom keyboard.

CppCast Episode 114: Building Debuggers and Keyboards with Simon Brand

About the interviewee:

Simon is a GPGPU toolchain developer at Codeplay Software in Edinburgh. He turns into a metaprogramming fiend every full moon, when he can be found bringing compilers to their knees with template errors and debating undefined behaviour on the C++ Slack channel. He co-organises the Edinburgh C++ user group and contributes to various programming standards bodies.

Outside of programming, he enjoys experimental films, homebrewing, and board games.

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.

C++17 Features And STL Fixes In VS 2017 15.3—Stephan T. Lavavej

It's always getting better!

C++17 Features And STL Fixes In VS 2017 15.3

by Stephan T. Lavavej

From the article:

Visual Studio 2017’s first toolset update, version 15.3, is currently in preview and will be released in its final form very soon. (The toolset consists of the compiler, linker, and libraries. After VS 2017 RTM, the 15.1 and 15.2 updates improved the IDE. The 15.3 update improves both the IDE and the toolset. In general, you should expect the IDE to be updated at a higher frequency than the toolset.)

Video: C++ Concepts TS and Request for Input—everythingcpp

This video teaches the Concepts syntax and motivation, with a request for viewers to try it out for themselves, to submit back their usage, to help guide a paper for the upcoming Albuquerque meeting.

C++ Concepts Intro: Need Your Input

by everythingcpp

From the article:

C++20 is slated to add most of the contents of the Concepts Technical Specification. Concerns about teach/learn-ability and usage preferences has kept some features from going in. This video covers introductory material on Concepts in C++ as it is in the technical specification. Afterward, I would like to hear from you!