Effective Modern C++ due October, preview in early July -- Scott Meyers

Scott Meyers' highly anticipated new book Effective Modern C++ is on the way:

Effective Modern C++ Status Report

by Scott Meyers

From the announcement:

In recent days, two major milestones for Effective Modern C++ have been achieved. First, I sent a draft of the book's Introduction out for technical review. That was the last part of the book to be written, so I finally have a full draft manuscript. Second, I received an image of the book cover from my publisher, so I now know what the book will look like.

...

  • Early October: Digital versions of the book become available.
  • Late October: Print versions of the book become available.

If you're dying to see what's in the book, and you don't mind dealing with a manuscript that's in draft form (and hence contains technical errors, awkward prose, Item titles in need of revision, primitive diagrams, confusing explanations, and, I hope, some stuff in decent shape), Effective Modern C++ will be part of O'Reilly's Early Release Program, meaning you'll have a chance to see the book in the same form as my technical reviewers. You'll also be able to offer comments on it. As things stand now, the book is slated to be available in Early Release form the week of July 7th.

Why C++ Sails When the Vasa Sank -- Scott Meyers

Now available online, a nice talk by Scott Meyers about why modern C++ is alive and continues to enjoy life and growth:

 

Why C++ Sails When the Vasa Sank

by Scott Meyers

The Vasa was a 17th-century Swedish warship which suffered such feature creep during construction that it sank shortly after leaving the harbour on its maiden voyage. In the early 1990s, the C++ standardisation committee adopted the Vasa as a cautionary tale, discouraging prospective language extensions with "Remember the Vasa!" Yet C++ continued to grow, and by the time C++ was standardised, its complexity made the Vasa look like a rowboat.

The Vasa sank, however, while C++ cruised, and it looks likely to continue doing so even as the latest revised standards (C++11 and C++14) add dozens of new features, each with its own idiosyncrasies. Clearly, C++ has gotten some important things right. In this talk, Scott Meyers considers the lessons to be learned from the ongoing success of a complex programming language that's over 30 years old, yet very much alive and kicking.

Using variadic macros -- Andrzej KrzemieĊ„ski

The latest from the desk of Andrzej:

Using variadic macros

by Andrzej Krzemieński

From the article:

But what struck me was something different. Why is it only some compilers that rejected my code. Why did most of the other compilers accept my apparently buggy code and produced the right result?

The answer is in the title of this post. Boost.StaticAssert is clever and wherever possible it uses variadic macros. ... it is now OK: all these arguments along with the separating commas are forwarded further (e.g., to static_assert) to the code that knows how to interpret these tokens. This is a very nice usage of variadic macros.

CppCon Program Preview, 6 of N -- Boris Kolpackov

cppcon-081.pngMore CppCon 2014 accepted talks have just been announced, below. For past announcements about the conference program, see also:

Early Bird registration is available until June 30.

 

CppCon Program Preview, 6 of N

by Boris Kolpackov

From the announcement:

Stefanus Du Toit: “Hourglass Interfaces for C++ APIs”
Pedro Ramalhete, Andreia Correia: “How to Make Your Data Structures Wait-Free for Reads”
Gor Nishanov: “await 2.0: Stackless Resumable Functions”
Fedor Pikus: “Where did My Performance Go? (Scaling Visualization in Concurrent C++ Programs)”
Łukasz Mendakiewicz: “Viewing the World Through Array-Shaped Glasses”

 

Stefanus Du Toit: “Hourglass Interfaces for C++ APIs”

C++ provides a much richer set of abstractions than C. Classes, templates, overloading, and other core C++ features can be leveraged for more readable syntax, better compile time typechecking, more open ended genericity and improved modularity. On the flip side, C89 still boasts some advantages over C++, especially when viewed through a pragmatic lens. C ABIs on many platforms have been stable for decades, practically every language supports binding to C code through foreign function interfaces, and including nearly any C89 header has a negligible effect on compile time on modern computers. The Hourglass pattern provides the best of both worlds. It’s a way to structure libraries that retains the pragmatic benefits of C89 while still providing C++’s richness both at an interface and implementation level. It makes providing bindings from other languages to C++ libraries easier, and insulates from ABI issues such as incompatibilities between debug and release variants of runtimes. This talk provides an overview of the pattern, teaches practical techniques for its implementation using C++98 and C++11, and shares experience from using the pattern in real world projects.

Speaker’s bio: Stefanus Du Toit is a Software Lead at Thalmic Labs, where he enables amazing gestural experiences using the Myo armband. Stefanus previously worked as a Software Architect and Software Development Manager at Intel Corporation, and co-founded RapidMind (acquired by Intel), a startup that targeted GPUs and other processors using standard C++. Stefanus served on the C++ standards committee as Project Editor for C++14 and as Committee Secretary. He lives in Kitchener-Waterloo, Ontario, Canada and holds a BMath CS from the University of Waterloo.

 

Pedro Ramalhete, Andreia Correia: “How to Make Your Data Structures Wait-Free for Reads”

In this talk we will describe a new concurrency control algorithm with Blocking write operations and Wait-Free Population Oblivious read operations, which we named the Left-Right algorithm. We will show a new pattern where this algorithm is applied, which requires using two instances of a given resource, and can be used for any data structure, allowing concurrent access to it similarly to a Reader-Writer lock, but in a non-blocking manner for reads, including safe memory management without needing a GC.

Speaker’s bio: Pedro Ramalhete has a PhD in Particle Physics for research done at CERN. Most of the research itself required programming in C++, and he also had a major participation in the coding of the experiment’s data acquisition and decoding software in C and C++. Pedro is currently working at Cisco writing networking software, with emphasis on real-time concurrent synchronization techniques, and wait-free/lock-free data structures.

 

Gor Nishanov: “await 2.0: Stackless Resumable Functions”

When dealing with the task/future based asynchronous model, developers need to write lambda-heavy continuation code with potentially multiple nesting lambdas. This makes the code less readable and not very pleasant to write. Stackless resumable functions allow developers to use more natural imperative coding style and provide performance benefits that are not possible with library-only solutions.

Speaker’s bio: Gor Nishanov is a Principal Software Design Engineer on the Microsoft C++ team. He works on the ‘await’ feature. Prior to joining the C++ team, Gor was working on distributed systems in Windows Clustering team.


Fedor Pikus: “Where did My Performance Go? (Scaling Visualization in Concurrent C++ Programs)”

High performance is one of the main reasons programmers choose C++ for their applications. If you are writing in C++, odds are you need every bit of computing power your hardware can provide. Today, this means writing multi-threaded programs to effectively utilize the multiple CPU cores that the hardware manufacturers keep adding. Everyone knows that writing multi-threaded programs is hard. Writing correct multi-threaded programs is even harder. Only after spending countless hours debugging race conditions and weird intermittent bugs do many programmers learn that writing efficient multi-threaded programs is harder yet. Have you ever wanted to see what are all your threads doing when they should be busy computing? This talk will show you how. We begin by studying several techniques necessary for collecting large amounts of data from the running program very efficiently, with little overhead and minimal disruption to the program itself. We will cover efficient thread-safe memory management and efficient thread-safe disk I/O. Along the way we dabble in lock-free programming just enough to meet our needs, lest the subject will spiral into an hour-long talk of its own. With all these techniques put together, we can collect information about what each thread is doing, which threads are computing and what exactly, and which threads are slacking off waiting on locks, and do it at the time scale of tens of microseconds if necessary. Then we process the collected data and create a timeline that shows exactly what the program was doing at every moment in time.

 

Łukasz Mendakiewicz: “Viewing the World Through Array-Shaped Glasses”

It’s agreed among experts that the most performant data structure in C++ is an array. Or a vector. Or a dynarray. Indeed, until recently there was no standardized approach in C++ to view these types in a uniform manner. It was even murkier when the data had logically more than one dimension. This talk is an introduction to the new features proposed for C++17 in N3851 bringing all contiguous data into harmony and lifting it to higher dimensions: index, bounds, array_view and more. Attendees will also learn how indexable algorithms differ from the traditional elemental ones, and what does it mean for parallelism.

Speaker’s bio: Łukasz Mendakiewicz is a software engineer at Microsoft, where he focuses on the customer experience with parallel programming models for C++. He is especially interested in GPGPU acceleration, and puts this passion to work on C++ AMP. He holds an M.S. in Computer Science from AGH UST in Krakow, Poland.

Masking a Class in Boost Graph, Part 3: Finding the Path -- Vadim Androsov

Part 3 of Vadim's experience report about using Boost's graph support in an existing game app:

Masking a Class in Boost Graph. Part 3: Finding the Path

by Vadim Androsov

From the article:

In the previous articles of the series we’ve reviewed the adaptive process of the square game field for concepts of boost graphs. Now we’ll consider the process of finding the path in the square field. Implementation of boost search allows adapting the algorithm quite accurately. In this article we’ll provide just one example of such parameterization – an ability to create various lengths of graph edges. ...

Game Changer -- Tony DaSilva

A little more fodder for those still trying to get their management or team to adopt modern C++:

Game Changer

by Tony DaSilva

From the article:

Even though I’m a huge fan of the man, I was quite skeptical when I heard Bjarne Stroustrup enunciate: "C++ feels like a new language". Of course, Bjarne was talking about the improvements brought into the language by the C++11 standard.

Well, after writing C++11 production code for almost 2 years now (17 straight sprints to be exact), I’m no longer skeptical. ... It seems that the authors of the “High Integrity C++” coding standard agree with my assessment. ...

Modernizing Legacy C++ Code -- James McNellis

mcnellis-2014.PNGFrom Techdays 2014 the Netherlands:

Modernizing Legacy C++ Code

by James McNellis

In this session, James McNellis, a developer on the Visual C++ libraries team, will share his experience using elements of modern C++ to improve a large legacy code base. Learn how to apply principles of modern C++ to gradually improve the quality of legacy code and improve maintainability and debuggability

CMake 3.0.0 Released

A new major version of CMake, v3.0.0 has been released. CMake is a tool for cross platform C/C++ (and more) build poject configuration.

Version 3.0.0 contains many improvements. To get an idea of the recent changes, as well as the improvements of CMake over the last months and years, take a look at the following links:

 

EuroLLVM videos and slides now available

eurollvm-2014.PNGAll available videos are now posted from this April's EuroLLVM conference.

The conference included the following C++-related sesssions. Note that only the first two have video, all have slides or other materials.

 

Keynote: What's new in C++14, and how you can take advantage of it (slides) -- Marshall Clow

Portable Native Client. Fast, Secure, Simple: Pick Three. (slides) -- JF Bastien

clang-tidy - Lint-like checks and beyond (slides) -- Daniel Jasper

Refactoring a large C++ codebase using clang (slides) -- Nick Lewycky

Async Magic - std::async in C++ and its consequences for optimizations (slides) -- Tobias Rieger

Intel Clang-Based C++ Compiler (poster) -- Andrey Bokhanko

Clang as a C++ front-end for Frama-C and VeriFast (poster) -- Virgile Prevosto, Franck Védrine, Bart Jacobs and Gijs van Spauwen