Loading…
This event has ended. Visit the official site or create your own event on Sched.
View analytic

Log in to bookmark your favorites and sync them to your phone or calendar.

•Object Model [clear filter]
Tuesday, September 26
 

9:00am

The Nightmare of Move Semantics for Trivial Classes
Assume, we implement a very simple class having just multiple string members. Even ordinary application programmer prefer to make it simple and fast.

You think you know how to do it? Well beware! It can become a lot harder than you initially might assume.

So, let’s look at a trivial class with multiple string members and use live coding to see the effect using different implementation approaches (using constructors passing by value, by reference, by perfect forwarding, or doing more sophisticated tricks).

Sooner than later we will fall into the deep darkness of universal/forwarding references, enable_if, type traits, and concepts.

Speakers
avatar for Nicolai Josuttis

Nicolai Josuttis

IT Communication
Nicolai Josuttis (http://www.josuttis.com) is an independent system architect, technical manager, author, and consultant. He designs mid-sized and large software systems for the telecommunications, traffic, finance, and manufacturing industries. He is well known in the programming community because he not only speaks and writes with authority (being the (co-)author of the world-wide best sellers The C++ Standard Library... Read More →


Tuesday September 26, 2017 9:00am - 10:00am
Berry Hall Meydenbauer Center

2:00pm

dynamic_cast From Scratch
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-scratch/tree/master/dynamic-cast#dynamic_cast-from-scratch

Speakers
avatar for Arthur O'Dwyer

Arthur O'Dwyer

Core Engineering, Nominum
Arthur O'Dwyer worked for many years at Green Hills Software, making the world's most optimizing C and C++ compilers. Now he works at Nominum in San Francisco. Arthur is the showrunner of the Bay Area C++ meetup, which meets practically every week these days.


Tuesday September 26, 2017 2:00pm - 3:00pm
Harvard (406) Meydenbauer Center
 
Thursday, September 28
 

9:00am

Runtime Polymorphism: Back to the Basics
C++ solves the problem of runtime polymorphism in a very specific way. It does so through inheritance, by having all classes that will be used polymorphically inherit from the same base class, and then using a table of function pointers (the virtual table) to perform dynamic dispatch when a method is called. Polymorphic objects are then accessed through pointers to their base class, which encourages storing objects on the heap and accessing them via pointers. This is both inconvenient and inefficient when compared to traditional value semantics. As Sean Parent said: Inheritance is the base class of evil.

It turns out that this is only one of many possible designs, each of which has different tradeoffs and characteristics. This talk will explore the design space for runtime polymorphism in C++, and in particular will introduce a policy-based approach to solving the problem. We will see how this approach enables runtime polymorphism with stack-allocated storage, heap-allocated storage, shared storage, no storage at all (reference semantics), and more. We will also see how we can get fine-grained control over the dispatch mechanism to beat the performance of classic virtual tables in some cases. The examples will be based on a real implementation in the Dyno library [1], but the principles are independent from the library.

At the end of the talk, the audience will walk out with a clear understanding of the different ways of implementing runtime polymorphism, their tradeoffs, and with guidelines on when to use one implementation or another.

[1]: https://github.com/ldionne/dyno

Speakers
avatar for Louis Dionne

Louis Dionne

Software Engineer, Amazon
Louis is a math and computer science enthusiast with interest in C++ (meta)programming, functional programming, domain specific languages and related subjects. He is a member of the C++ Standards Committee and of the Boost community, where he authored the Boost.Hana metaprogrammi... Read More →


Thursday September 28, 2017 9:00am - 10:00am
Berry Hall Meydenbauer Center

2:00pm

Objects, Lifetimes, and References, oh my: the C++ Object Model, and Why it Matters to You
How does the C++ abstract machine really work at the lowest levels? Why does the committee design its rules the way they do? Gain insight into the object model of C++, from references to passing semantics to copy elision. C++ is a complicated language full of arcane rules and complicated tangents - learn how it's all tied together in this basic model of locations, objects, and values.

Speakers
NM

Nicole Mazzuca

None
Nicole Mazzuca is a C++ and Rust programmer who is very interested in object models - she is helping to write the Rust object model, and as such has studied other object models heavily, especially C++'s.


Thursday September 28, 2017 2:00pm - 3:00pm
Colossus Theater Meydenbauer Center
 
Friday, September 29
 

9:00am

C++ Exceptions and Stack Unwinding
Exceptions are often described as 'slow', and the standard advice is to use them only in exceptional circumstances. In this talk, we'll find out how slow exceptions really are by exploring the Itanium exception handling model.

We'll dive into several implementations (libunwind, gcc, llvm-libunwind), and learn about everything that happens between throw() and catch(). We will discover the answers to questions such as why throwing an exception takes a global lock (and how to avoid it), how caching can speed up the performance of exceptions, and how to get better stack traces.

Speakers
avatar for David Watson

David Watson

Engineer, Facebook
Dave Watson is an infrastructure engineer at Facebook. He has been focused on improving the application server stack, including improvements in RPC, load balancing, memory management, and asynchronous programming. He has contributed to many of Facebook's core services and OSS pro... Read More →


Friday September 29, 2017 9:00am - 10:00am
Berry Hall Meydenbauer Center

10:30am

What C++ developers should know about globals (and the linker)
Most C++ developers know that using globals (or singletons) excessively in code is usually a poor decision. But it is also hard to deny their usefulness in more than one situation: for loggers, factories, intrusive performance benchmarking, and other very useful applications, globals can be very helpful.

Unfortunately, usage of globals in C++ ends up exposing details of the language not seen so often otherwise. Instead of dealing with our tried-and-true, well specified compiler, we often need to look more at the behavior of the linker, which can vary more between platforms and between different options such as static vs dynamic linking.

This talk will look at some surprising pitfalls that can occur with globals: valid programs only a dozen lines long that can trigger segfaults when using the gcc linker. It will explore some of these issues using command line tools like nm and objdump. The talk will enumerate several pitfalls to be avoided. It will look at some of the different axes of the problem space such as: globals that are private versus public, eager versus lazy, global inter-dependencies, and quality of emitted assembly. Finally, solutions and idioms will be presented that address the major use cases, and make it easy for developers to use globals (only where necessary!) in a safe way.


Speakers
avatar for Nir Friedman

Nir Friedman

Trading Software Developer, Tower Research Capital
After completing a PhD in physics, Nir started working doing C++ in low latency and high frequency trading. He's interested in the challenges of writing robust code at scale, and highly configurable code that minimizes performance trade-offs.


Friday September 29, 2017 10:30am - 11:00am
Berry Hall Meydenbauer Center