Meeting 13 June 2019

P0976r0: Bjarne Stroustrup - The Evils of Paradigms

In programming, some people deem imperative, object-oriented, and functional programming different paradigms. I think the very notion of a paradigm does harm to use and to design because people all too easily fall into the trap of considering only one paradigm “good” and then try to fit everything into it, discarding all aspects of alternative “paradigms” as wrong or inferior (aka “If your only tool is a hammer, everything looks like a nail”).

CppCast: Pattern Matching with Michael Park

P1371: Pattern Matching

The Story: Bloomberg senior developer Elliot Goodrich

I don't think C++ is dying by any stretch of the imagination.

Enum template parameters

enum Foo {FooBar, FooBaz};

template<Foo foo>
struct Test {
    Kind kind{foo};

int main() {
    Test<FooBar> fooBar;

Roman numerals in C++

Unrelated: What are the rules about using an underscore in a C++ identifier?

Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.

Understanding when not to std::move in C++

GCC 9:

-Wall -Wpessimizing-move


T fn() {
  T t;
  return std::move(t); // Prevents NRVO: returned expression must be a name

GCC 9:

-Wextra -Wredundant-move


struct T {
  T(const T&) = delete;

T fn(T t) {
  return std::move(t); // Redundant: move used implicitly

When std::move makes sense:

struct U {};
struct T : U {};

U f() {
  T t;
  return std::move(t); // Necessary


When a function returns an object whose type is a class derived from the class type the function returns. In that case, overload resolution is performed a second time, this time treating the object as an lvalue.


A variadic, completion-based future class for C++17 (Apache 2.0)

Using main is undefined behaviour

Shafik Yaghmour:

int main() {
    decltype(main()) x;
    return static_cast<bool>(&main);

Attempting to modify a const object is undefined behaviour

Shafik Yaghmour:

int b() {
    const int x=1;
    int* p = const_cast<int*>(&x); // OK
    *p = 2;                        // UB
    return *p;

C++17 STL Parallel Algorithms - with GCC 9.1 and Intel TBB on Linux and macOS

Threading Building Blocks (TBB)

GitHub: (Apache 2.0)

Since 2018 U5 TBB binary packages include Parallel STL as a high-level component.

Parallel STL: (Apache 2.0)


Melinda Varian:

The best programs are the ones written when the programmer is supposed to be working on something else.