intermediate

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.

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. ...

Lightweight HTTP Server in less than 40 Lines on libevent and C++11 -- NYM

kukuruku.PNGFresh on Kukuruku:

Lightweight HTTP Server in less than 40 Lines on libevent and C++11

by NYM

From the article:

Looking through programming articles sometimes I see posts about creating your own HTTP server. I am most interested in C++ so I often read blogs about it. After looking them through you could easily write you own web server “on sockets” using boost.asio or something else. I also examined libevent and libev. Each of them has its advantages. Libevent is of great interest to me for developing a small HTTP server. Considering some innovations in C++11 the code becomes much more space-efficient and allows for the creation of a basic HTTP server in less than 40 lines.

Ref-qualifiers -- Andrzej KrzemieĊ„ski

The latest from the desk of Andrzej:

Ref-qualifiers

by Andrzej Krzemieński

From the article:

In this post I want to describe a small language feature added in C++11 that, although essential for full value semantics support, is often neglected in tutorials and in compiler implementations....

Writing min function, part 1: The rise of Concepts -- Fernando Pelliccioni

[Ed: Note that this article series is not (yet) about C++ code, but it promises to go there and it has an interesting pedigree in its generic programming design analysis (Alex Stepanov) and reviewers (several ISO C++ participants including Andrzej Krzemienski and Dean Michael Berris.]

Writing min function, part 1: The rise of Concepts

by Fernando Pelliccioni

From the article:

This is the first in a series of articles in which I want to transmit what I learned (or what I think I learned) from the books, papers, lectures of Alexander Stepanov.

These are the lessons that Alex gives us, and I want to show them in this series:

  • Specify our algorithms correctly
  • Programming must be based on a solid mathematical foundation
  • Designing our API’s consistently
  • Not always the library implementations provided by the programming languages we use are correct, even though they are designed by “experts”.
  • The concept of Stability
  • Generic programming, of course!

Ref-qualified member functions -- Alexander Kulikov

kukuruku.PNGToday on Kukuruku:

Ref-qualified member functions

by Alexander Kulikov

From the article:

Today I’m going to tell you about a new and a little known (to my mind) C++ feature — reference-qualified member functions. I’ll tell about the rules of such functions overloading and, as an example of use, I’ll show you that with the help of ref-qualified you can try to improve the resource management scheme, which is implemented with the help of another C++ idiom — RAII.

Vector of Objects vs Vector of Pointers Updated -- Bartlomiej Filipek

More in the "contiguous enables fast" department:

Vector of Objects vs Vector of Pointers Updated

by Bartlomiej Filipek

From the article:

For 1000 particles we need on the average 2000 cache line reads! This is 78% more cache line reads than the first case! Additionally Hardware Prefetcher cannot figure out the pattern -- it is random -- so there will be a lot of cache misses and stalls.

In our experiment the pointer code for 80k of particles was more 266% slower than the continuous case.

ACCU 2014 talk slides now available

[Ed: Here's a candidate for the most hilarious thing you'll probably see today: Kevlin Henney's slide deck, including a link to this @netbat tweet.]

The recent ACCU 2014 was another resounding success, and many of the talk slides have now been posted. You can find them here:

Slides, Photos, Blogs via #accu2014 (accu.org)

Some fun C++ highlights with slides available include:

  • Dietmar Kuhl · Performance Choices
  • Howard Hinnant · Everything You Ever Wanted To Know About Move Semantics (and then some)
  • Hubert Matthews · Where is C++ headed?
  • Jonathan Wakely · There Ain't No Such Thing As A Universal Reference
  • Jonathan Wakely · The C++14 Standard Library
  • Kevlin Henney · Immutabilty FTW!
  • Marshall Clow · C++ Undefined Behavior -- what is it, and why should I care?
  • Olve Maudal · C++ Pub Quiz
  • Pattabi Raman · Random number generation in C++ -- present and potential future
  • Peter Sommerlad · C++14 an overview on the new standard for C++(11) programmers
  • Steve Love · Range and Elevation -- C++ in a modern world
  • ... and more (see the page).

CppCon: My Proposed Talks (Part 2) -- Herb Sutter

cppcon-108.PNGFollowing up on Herb's three talk proposals posted yesterday, the other two titles and abstracts are now posted, this time of new talks (note: again, pending review and selection by the program committee, so this is not final -- they may or may not be selected if there is stronger material).

CppCon: My Proposed Talks (Part 2)

by Herb Sutter

From the post:

GC for C++, and C++ for GC: “Right” and “Wrong” Ways to Add Garbage Collection to C++ (1 to 2 hours)

"Garbage collection is essential to modern programming!" "Garbage collection is silly, who needs it!"

As is usual with extremes, both of these statements are wrong. Garbage collection (GC) is not needed for most C++ programs; we're very happy with determinism and smart pointers, and GC is absolutely penalizing when overused, especially as a default (or, shudder, only) memory allocator. However, the truth is that GC is also important to certain high-performance and highly-concurrent data structures, because it helps solve advanced lock-free problems like the ABA problem better than workarounds like hazard pointers.

This talk presents thoughts about how GC can be added well to C++, directly complementing (not competing with) C++'s existing strengths and demonstrating why, as Stroustrup says, "C++ is the best language for garbage collection."

 

Addressing C++’s #1 Problem: Defining a C++ ABI (1 hour)

"Why can't I share C++ libraries even between my own internal teams without using the identical compiler and switch settings?" "Why are operating system APIs written in unsafe C, instead of C++?" "Why can’t I use std::string in a public shared library interface; it's the C++ string, isn't it?!"

These and more perennial questions are caused by the same underlying problem: For various historical reasons, C++ does not have a standard binary interface, or ABI. Partial solutions exist, from the Itanium ABI which addresses only the language and only on some platforms, to COM and CORBA which do both less and far more than is needed.

It is deeply ironic that there actually is a way to write an API in C++ so that it has a de facto stable binary ABI on every platform: extern "C".

This session describes current work driven by the presenter to develop a standard C++ ABI. This does not mean having identical binaries on all platforms. It does mean tackling all of the above problems, including directly addressing the #1 valid reason to use C instead of C++, and removing a major obstacle to sharing binary C++ libraries in a modern way.