CppCon 2017: dynamic_cast From Scratch--Arthur O'Dwyer

Have you registered for CppCon 2018 in September? Early bird registration is open now.

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

dynamic_cast From Scratch

by Arthur O'Dwyer

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

This session will introduce you to the C++ object model: the rules by which C++ class objects are translated into memory layouts. We'll quickly cover polymorphic class types and multiple and virtual inheritance. We'll discuss the anatomy of a virtual method call, the difference between `static_cast` and `reinterpret_cast`, and what's contained in a vtable besides function pointers. We'll see that the way `dynamic_cast` thinks about the class hierarchy is slightly different from the way we're used to drawing it; and that `dynamic_cast` is expensive enough that sometimes we can find cheaper ways to ask an object for its type! The climax will be a complete, bug-free, and fast implementation of C++'s built-in `dynamic_cast`, using our own hand-crafted artisanal run-time type information (RTTI).

Attendees will incidentally be exposed to several features of the modern C++ language, including type traits and the `final` qualifier.

This session will mostly be talking about the Itanium C++ ABI, which is the standard on Linux and OS X systems. Mapping these concepts to the MSVC ABI will be left as an exercise for the reader of the project's GitHub repo: https://github.com/Quuxplusone/from-s...

Quick Q: Accessing protected members in a derived class

Quick A: Only your own type can be accessed.

Recently on SO:

Accessing protected members in a derived class

You can only access protected members in instances of your type (or derived from your type).
You cannot access protected members of an instance of a parent or cousin type.

In your case, the Derived class can only access the b member of a Derived instance, not of a different Base instance.

Changing the constructor to take a Derived instance will also solve the problem.

ZAPCC compiler is now available under Open Source -- Ceemple

The company Ceemple just released their C++ compiler under Open Source license.

Zapcc compiler open source now available

by Ceemple

About the compiler:

Zapcc is a newer C++ compiler that goes for

  • Faster Builds: Significant compilation speedups for heavy templated C++ headers such as ScyllaDB, Webkit, LLVM
  • Clang/LLVM Based: Zapcc is based on clang and frequently updated from the latest svn
  • Full Linux Support: Zapcc currently supports Linux x64, Windows x64 support with mingw-w64 is experimental 
  • Drop-in Replacement: Zapcc is a drop-in replacement for clang and gcc, and supports all build system

CopperSpice: Futures & Promises

New video on the CopperSpice YouTube Channel:

Futures and Promises

by Barbara Geller and Ansel Sermersheim

About the video:

In this video we talk about the concepts of futures, promises, and async. We explore why these concepts are useful, what the applications are, and also discuss some of the shortcomings of the current standard implementation.

Please take a look and remember to subscribe!

Dublin C++ Group: Variadic templates and fold-expressions -- Denis Sukhonin

Talk from Dublin C++ User Group 11.06.2018.

Variadic templates and fold-expressions

by Denis Sukhonin

About the session:

Abstract: It all started with a single printf causing undefined behavior due to mismatch of the format string and arguments. To solve similar problems in a type-safe manner C++ introduced variadic template parameters and fold-expressions. Denis covers the basics and shows how a type-safe printf function can be implemented.

Slides: https://goo.gl/mmzdrH

 

PVS-Studio 6.24 released

A new release of the PVS-Studio static code analyzer became available to download. This tool is designed to detect errors and potential vulnerabilities in the source code of programs, written in C, C++, and C#.

PVS-Studio 6.24 released

by Andrey Karpov

From the article:

Support for Texas Instruments Code Composer Studio, ARM compiler was added under Windows\Linux. 8 new diagnostics were introduced to detect errors in C and C++ code. In addition to the development of new diagnostics, we continue improving Data-Flow analysis that enables old diagnostics find more bugs. Thanks to these improvements, the analyzer finds more interesting errors, like the one we described in the article "February 31". Download and try PVS-Studio.

The first 5 companies have joined the employer listing at Meeting C++!

Since this year, Meeting C++ offers companies the option to be listed as a C++ employer:

The first 5 companies have joined the employer listing!

by Jens Weller

From the article:

Happy to report that now 5 companies are listed in the employer listing in the Meeting C++ job section!

These are:

    KDAB
    QuasarDB
    think-cell
    Tenzir
    Rieke Computersysteme