January 2018

C++ Status at the end of 2017

Bartek's non-official year report

C++ Status at the end of 2017

by Bartlomiej Filipek

From the article:

Four things that I’d like to emphasize for the year:

  • C++17 and the stable progress of the standardization
  • Transparency of the Committee and compiler vendors
  • Community is growing!
  • More tools!

The Pimpl Pattern - what you should know--Bartlomiej Filipek

A good sum up.

The Pimpl Pattern - what you should know

by Bartlomiej Filipek

From the article:

Have you ever used the pimpl idiom in your code? No matter what’s your answer read on smile

In this article I’d like to gather all the essential information regarding this dependency breaking technique. We’ll discuss the implementation (const issue, back pointer, fast impl), pros and cons, alternatives and also show examples where is it used. You’ll also see how modern C++ can change this pattern. Moreover, I hope you’ll help me and provide your examples...

Introduction to std::chrono--Rachel Crawford

How to measure time in C++?

Introduction to std::chrono

by Rachel Crawford

From the article:

How many times have you tried to call a function that alleges to return a time value only to realise you don’t know what units the value is in? Or that takes a time value as a parameter, but doesn’t specify whether the value is expected to be in milliseconds, seconds, or hours?

Chaining Comparisons: Seeking Information from the Audience--Barry Revzin

A nice example of committee members reaching out to the community for data/input on proposed changes that could have a breaking impact.

Chaining Comparisons: Seeking Information from the Audience

by Barry Revzin

From the article:

At the last standards committee meeting in Albuquerque, the spaceship operator was adopted into the working draft for what will eventually be C++20. I’m already pretty excited about that. But one of the initial “optional” parts of Herb Sutter’s original spaceship proposal (which was dropped early) was to support chaining comparisons...

Report from using std::cpp 2017 -- Daniel Garcia

Last November, 30th we had the 5th edition of using std::cpp (the annual C++ conference in Spain). Around 200 people gathered for a one-day event of C++ talks.

Using std::cpp 2017 Conference Report

by Daniel Garcia

From the report:

We used the evaluation forms to survey what people is using in their daily job. And we got some pleasent surprises about new standards adoption. It seems C++98/03 usage is going down!


Quick Q: Function not called in code gets called at runtime

Quick A: undefined behaviour can result in anything.

Recently on SO:

Function not called in code gets called at runtime

The program contains undefined behavior, as dereferencing a null pointer (i.e. calling foo() in main without assigning a valid address to it beforehand) is UB, therefore no requirements are imposed by the standard.

Executing never_called at runtime is a perfect valid situation when undefined behavior has been hit, it's as valid as just crashing (like when compiled with GCC). Okay, but why is Clang doing that? If you compile it with optimizations off, the program will no longer output "formatting hard disk drive", and will just crash...

Quick Q: Confused about vectors

Quick A: Do not confuse mathematical concepts with C++ terminology.

Recently on SO:

Confused about vectors

You are getting confused because the mathematical concept of a vector can mean a "collection of data" and that is what you were taught int v[10] was. The actual name for that in C++ (and most other languages) is an "array" not a vector.

The libraries referred to in C++ Primer have a class called "vector" which is an implementation of an array. They are similar, but not the same.

I hope that clears that up a bit. You are probably confused because you were taught that int v[10] is a vector, but it is "not really" in C++. It's an array. Use that term to refer to it. If you ever refer to it as a vector, you will confuse others and yourself.