July 2017

Trip report: Evolution Working Group at the Summer ISO C++ standards meeting Toronto—Andrew Pardoe

The evolution does not stop.

Trip report: Evolution Working Group at the Summer ISO C++ standards meeting (Toronto)

by Andrew Pardoe

From the article:

The Summer 2017 ISO C++ standards meeting was held in July 10-15 at the University of Toronto. Many thanks to Google, Codeplay, and IBM for sponsoring the event, as well to folks from Mozilla, Collège Lionel-Groulx, Christie Digital Systems, and Apple for helping to organize. And, of course, we very much appreciate Waterfront International for sponsoring a banquet at the CN Tower.

C++17: Structured Bindings—Marc Gregoire

It is coming!

C++17: Structured Bindings

by Marc Gregoire

From the article:

This is a first post in a series of short articles on new C++17 features. These articles will not contain all little details of the new features being presented, but they give you an idea about what new functionality has been added to C++17.

CppCon 2016: Iterator Haiku—Casey Carter

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:

Iterator Haiku

by Casey Carter

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Iterator Haiku: How five iterator categories blossomed into seven, and Sentinels trimmed them back to five again. Recently proposed changes to the ranges TS distill its seven iterator categories back to five without sacrificing any expressive power. Removing operations that are extraneous in the Sentinel world eliminates a potential source of programming errors.

What should the ISO C++ Standards Committee be doing?

What should the ISO C++ Standards Committee be doing?

Bjarne Stroustrup

There is a lot of talk within the committee and outside about how to chose what to work on, what processes will work best for handling proposals, and how to maintain a direction for the language.

In January, a group of heads of national delegations submitted a document entitled Operating principles for evolving C++ and the committee constituted a small group of experienced members to try to develop and maintain direction of the standards effort.

In June, Titus Winters and the members of the direction group submitted a follow-up document: C++ Stability, Velocity, and Deployment starting the process of making the principles real. This document was presented at the Toronto meeting to about 80 members in an evening session. It was very well received.

We are working to make the suggestions from those papers concrete to improve the standards process, and eventually help improve C++ and its ISO standard. Here, I would like to direct attention to one part of that document:

Proposal – “Our Promise To Users” a.k.a

“The C++ Programmers’ Bill of Rights.”

We, the ISO C++ Standards Committee, promise to the best of our ability to deliver the
following, assuming user code adheres to the current standard:

  1. Compile-time stability: Every change in behavior in a new version of the standard is detectable by a compiler for the previous version.
  2. Link-time stability: ABI breakage is avoided except in very rare cases, which will be welldocumented and supported by a written rationale.
  3. Compiler performance stability: Changes will not imply significant added compile-time costs for existing code.
  4. Run-time Performance stability: Changes will not imply added run-time costs to existing code.
  5. Progress: Every revision of the standard will offer improved support for some significant programming activity or community.
  6. Simplicity: Every revision of the standard will offer some simplification of some significant programming activity.
  7. Timeliness: The next revision of the standard will be shipped on time according to a published schedule.

Note “to the best of our abilities”. These are guiding principles, rather than executable statements. For example, if I add a function to a header file, the compilation of code that includes that header will slow down imperceptibly. That’s understood and could be argued not to be “existing code” because of the change. Adding enormous amounts of code to a header so that compilation slowed down noticeably
would be another matter.

These are ideals. They are what we would like to see done. I we succeed, most users will be very happy. However, they are not a recipe we could blindly follow to deliver a new standard. As is typical for ideals, they can conflict: there are tensions among the desired goals. This is common: Ideally, we want quality, on-time delivery, and low cost of products, but we know from vast experience that it is very hard to get all three. We want freedom of speech and absence of verbal intimidation, but balancing those two can be very hard. It is the same for the ideals of the “The C++ Bill of Rights”; we want all, but the committee will have to make hard choices.

These are ideals. They are meant to be rather grand statements, rather than nit-picked long sentences with every statement watered down by adjectives and caveats. It will be up to the committee members to interpret the ideals for real design and scheduling problems.

There are just 7 ideals listed and they are quite general. We could add many more, but a laundry list of specifics, would dull the appeal and be impossible to remember in the heat of discussions about direction, what can be delivered when, and specific technical concerns.

So, what do you think? Should the committee formally commit to this? Can it be improved? How? Obviously, we need a discussion within the committee and in the community in general before deciding on anything.

itCppCon17: C++ executors to enable heterogeneous computing in tomorrow's C++ today—Michael Wong

Videos of the Italian C++ Conference 2017 are popping up. Here is the keynote:

C++ executors to enable heterogeneous computing in tomorrow's C++ today

by Michael Wong


Summary of the talk:

For a long time, C++ has been outpaced by other models such as CUDA, OpenMP, OpenCL, HSA, which has offered Heterogeneous computing capability to enable dispatch to GPU, DSP, FPGA or other accelerators.
SG14 is an ISO C++ SG that works on low-latency, in the areas of Games, Financial, Embedded programming. One of their mandate is support of heterogeneous in Native C++, without having to drop to some other model as is needed today.
This talk will describe the first and possibly the most important step towards supporting heterogeneous computing with a description of C++ executors, an interface between concurrency constructs, and the agents/resources, one of which can be a GPU core, or a SIMD unit.  I have led a small group of experts from Google, Nvidia, Codeplay, and NASDAQ, to define a specification to enable separation of concerns in defining where, when, and how execution is done in service of the constructs in existing C++ standard library, Concurrency, Parallelism, Transactional Memory, and Networking TS.
This talk will help you understand these TSes which currently only works on CPUs and how they will tie together in future to enable execution on accelerators based on C++ models we already have today such as SYCL, HPX, Kokkos, and Raja. This will enable native C++ to be usable on machine learning algorithms on future self-driving cars, or medical devices.

CppCast Episode 111: Toronto Trip Report with Patrice Roy

Episode 111 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Patrice Roy to talk about the changes made to the C++20 Draft at the Toronto C++ Standards Committee Meeting.

CppCast Episode 111: Toronto Trip Report with Patrice Roy

by Rob Irving and Jason Turner

About the interviewee:

Patrice Roy has been playing with C++, either professionally, for pleasure or (most of the time) both for over 20 years. After a few years doing R&D and working on military flight simulators, he moved on to academics and has been teaching computer science since 1998. Since 2005, he’s been involved more specifically in helping graduate students and professionals from the fields of real-time systems and game programming develop the skills they need to face today’s challenges. The rapid evolution of C++ in recent years has made his job even more enjoyable.

He’s been a participating member in the ISO C++ Standards Committee since late 2014 and has been involved with the ISO Programming Language Vulnerabilities since late 2015. He has five kids, and his wife ensures their house is home to a continuously changing number of cats, dogs and other animals.

C++17 in details: Code Simplification—Bartlomiej Filipek

The series continue.

C++17 in details: Code Simplification

by Bartlomiej Filipek

From the article:

You might say that most of the new language features (not to mention The Standard Library improvements) are there to write simpler/cleaner code. The “C++17 in details” series reviews most of the bigger things, still for today, I tried to pick a few features that out of the box make your code more compact.

  • Structured bindings/Decomposition declarations
  • Init-statement for if/switch
  • Inline variables
  • constexpr if (again!)
  • a few other mentions

Quick Q: How to require an exact function signature in the detection idiom?

Quick A: Use is_detected

Recently on SO:

How to require an exact function signature in the detection idiom?

With C++17 is_detected, you may do

template <typename T, typename Ret, typename Index>
using subscript_t = std::integral_constant<Ret (T::*) (Index), & T::operator[]>;

template <typename T, typename Ret, typename Index>
using has_subscript = is_detected<subscript_t, T, Ret, Index>;

static_assert(has_subscript<std::vector<int>, int&, std::size_t>::value, "!");
static_assert(!has_subscript<std::vector<int>, int&, int>::value, "!");

CppCon 2016: GDB - A Lot More Than You Knew—Greg Law

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:

GDB - A Lot More Than You Knew

by Greg Law

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

If you’re writing C++ for anything other than Windows, chances are that you occasionally break out GDB. This session presents some of the lesser known features of GDB that can change the way you debug. GDB has come a long way in the last few years and now does so much more than break, print, step and continue. Reversible debugging; Non-Stop Mode; Multi-process Debugging; and Dynamic Printf are but some of its best features, and its built-in Python scripting is particularly powerful. Join Undo co-founder and CEO, Greg Law, as he takes you through a series of demos to show some amazing tricks with GDB and some of its powerful new (and not-so-new) features that you may not have heard of.

Metaclasses: Thoughts on generative C++—Herb Sutter

The ACCU 2017 keynote video is now online, with context and updates from this month's standards meeting:

Metaclasses: Thoughts on generative C++

by Herb Sutter

From the article:

I’ve been working on an experimental new C++ language feature tentatively called “metaclasses” that aims to make C++ programming both more powerful and simpler. You can find out about it here...