June 2018

CppCast Episode 155: C++ Insights with Andreas Fertig

Episode 155 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Andreas Fertig to discuss C++ Insights, the Rapperswil ISO meeting and more.

CppCast Episode 155: C++ Insights with Andreas Fertig

by Rob Irving and Jason Turner

About the interviewee:

Andreas Fertig holds an M.S. in Computer Science from Karlsruhe University of Applied Sciences. Since 2010 he has been a software developer and architect for Philips Medical Systems focusing on embedded systems. He has a profound practical and theoretical knowledge of C++ at various operating systems.

He works freelance as a lecturer and trainer. Besides this he develops macOS applications and is the creator of cppinsights.io.

CppCon 2017: Fuzz or lose...--Kostya Serebryany

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:

Fuzz or lose...

by Kostya Serebryany

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Fuzzing is a family of testing techniques in which test inputs are generated semi-randomly. The memory unsafety of C++ has made fuzzing a popular tool among security researchers. Fuzzing also helps with stability, performance, and equivalence testing; and it’s a great addition to everyone’s CI.

Our team has launched OSS-Fuzz, the Google's continuous fuzzing service for open source software, and a similar service for our internal C++ developers. Over 1000 C++ APIs are being fuzzed automatically 24/7, and thousands of bugs have been found and fixed.

Now we want to share this experience with the wider C++ community and make fuzzing a part of everyone’s toolbox, alongside unit tests. We will demonstrate how you can fuzz your C++ library with minimal effort, discuss fuzzing of highly structured inputs, and speculate on potential fuzzing-related improvements to C++.

C++17: Attributes--Marc Gregoire

Another new feature.

C++17: Attributes

by Marc Gregoire

From the article:

C++17 introduces three new code attributes:

  • [[fallthrough]]
  • [[maybe_unused]]
  • [[nodiscard]]

The first one was discussed in detail in my C++17: Fallthrough in switch statements blog post. The others are briefly explains below...

C++ rvalue references and move semantics for beginners

A collection of personal notes and thoughts on rvalue references, their role in move semantics and how they can significantly increase the performance of your applications.

C++ rvalue references and move semantics for beginners

by Triangles @ internalpointers.com

From the article:

In my previous article Understanding the meaning of lvalues and rvalues in C++ I had the chance to explain to myself the logic behind rvalues. The core idea is that in C++ you will find such temporary, short-lived values that you cannot alter in any way.

Surprisingly, modern C++ (C++0x and greater) has introduced rvalue references: a new type that can bind to temporary objects, giving you the ability to modify them. Why?

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.