How to avoid bugs using modern C++

One of the main problems with C++ is having a huge number of constructions whose behavior is undefined, or is just unexpected for a programmer. Let's see which techniques in modern C++ help writing not only simple and clear code, but make it safer and more reliable.

How to avoid bugs using modern C++

by Pavel Belikov

From the article:

Of course, there are some flaws in the range-based for: it doesn't allow flexible management of the loop, and if there is more complex work with indexes required, then for won't be of much help to us. But such situations should be examined separately. We have quite a simple situation: we have to move along the items in the reverse order. However, at this stage, there are already difficulties. There are no additional classes in the standard library for range-based for. Let's see how it could be implemented.

CppCon 2015 Work Stealing--Pablo Halpern

Have you registered for CppCon 2016 in September? Don’t delay – Late registration is open now.

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

Work Stealing

by Pablo Halpern

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

If you've used a C++ parallel-programming system in the last decade, you've probably run across the term "work stealing." Work stealing is a scheduling strategy that automatically balances a parallel workload among available CPUs in a multi-core computer, using computation resources with theoretical utilization that is nearly optimal. Modern C++ parallel template libraries such as Intel(R)'s TBB or Microsoft*'s PPL and language extensions such as Intel(R) Cilk(tm) Plus or OpenMP tasks are implemented using work-stealing runtime libraries.

Most C++ programmers pride themselves on understanding how their programs execute on the underlying machine. Yet, when it comes to parallel programming, many programmers mistakenly believe that if you understand threads, then you understand parallel runtime libraries. In this talk, we'll investigate how work-stealing applies to the semantics of a parallel C++ program. We'll look at the theoretical underpinnings of work-stealing, now it achieves near optimal machine utilization, and a bit about how it's implemented. In the process, we'll discover some pit-falls and how to avoid them. You should leave this talk with a deeper appreciation of how parallel software runs on real systems.

Previous experience with parallel programming is helpful but not required. A medium level of expertise in C++ is assumed.

Visual C++ for Linux 1.0.5 Updates -- Marc Goodner

The Visual C++ for Linux announcement post has been updated.

Visual C++ for Linux 1.0.5 Updates

by Marc Goodner

From the article:

We recently posted new bits for our 1.0.5 release of the Visual C++ for Linux extension for Visual Studio 2015. This release has some major performance improvements that feature incremental copy and build, and considerably reducing the number of connections to the remote Linux machine. We’ve also made significant improvements in IntelliSense since our last post here.

Exploring std::string--Shahar Mike

The insides are revealed:

Exploring std::string

by Shahar Mike

From the article:

Every C++ developer knows that std::string represents a sequence of characters in memory. It manages its own memory, and is very intuitive to use. Today we’ll explore std::string as defined by the C++ Standard, and also by looking at 4 major implementations.

Type annotation in C++--Stoyan Nikolov

How do you do it?

Type annotation in C++

by Stoyan Nikolov

From the article:

In systems like game engines and our HTML renderer Hummingbird, developers have to work with objects transformed in different coordinate systems. Using one generic type can lead to confusion on what object is required in a particular situation. Errors are often subtle and hard to track. I tried to mitigate this by using stringent static typing in our software. New types are created by annotating them with metadata...

CppCon 2015 3D Face Tracking and Reconstruction using Modern C++--Patrik Huber

Have you registered for CppCon 2016 in September? Don’t delay – Late registration is open now.

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

3D Face Tracking and Reconstruction using Modern C++

by Patrik Huber

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

In this talk, I will present my work in computer vision, namely landmark detection and 3D face tracking, and the two C++ libraries that were developed in the process. The first part of the talk will give an introduction to detecting facial landmark points and work through a hello-world code example that presents and uses the superviseddescent library, a cross-platform library for cascaded regression that can be used to solve problems like landmark detection or pose estimation. The second part of the talk will present an approach that uses the found landmarks from the first part to use a 3D face model to track a person's face. With the library presented in the process, we hope to make 3D models easier to use and more widespread in the community. Both libraries are designed to be lightweight and simple to use, and try to follow modern C++11/14 programming paradigms. The talk concludes with my views on code sustainability in academia and a wish list of standard library features for computer vision.

Auto Type Deduction in Range-Based For Loops--Petr Zemek

Which one to use?

Auto Type Deduction in Range-Based For Loops

by Petr Zemek

From the article:

Have you ever wondered which of the following variants you should use in range-based for loops and when? auto, const auto, auto&, const auto&, auto&&, const auto&&, or decltype(auto)? This post tries to present rules of thumb that you can use in day-to-day coding. As you will see, only four of these variants are generally useful.

Great Expectations--Glennan Carnie

Let's review the basics!

Great Expectations

by Glennan Carnie

From the article:

Previously, we’ve looked at the basic concepts of function parameter passing, and we’ve looked at the mechanics of how parameters are passed at the Application Binary Interface (ABI) level.

Far too often we focus on the mechanisms and efficiency of parameter passing, with the goal: if it’s efficient then it’s good; that’s all there is to it.  In this article I want to move past simple mechanics and start to explore function parameter design intent – that is, what can I expect (to change) about the objects I use as function arguments; and what can I expect to be able to do with an object as a function implementer.

To that end, we’ll take a look at parameter passing from the perspective of the mutability (ability to be modified) of the parameters from both a caller’s and a function’s (callee’s) point of view...