Loading…
CppCon 2018 has ended
View analytic
Tuesday, September 25 • 09:00 - 10:00
Avoiding Disasters with Strongly Typed C++

Sign up or log in to save this to your schedule and see who's attending!

C++ is often described as a type-safe language — the compiler will not allow the programmer to mix types freely. But do we really use C++ in a type-safe manner? When a programmer uses the same type to represent different quantities, one could argue that the compiler's type-checks are bypassed and errors due to mix-ups not only become possible, but frequent! In this session a solution to this problem will be presented — strong types.

Strong types are a type-safe alternative to typedefs — but where typedefs only provide documentation and ease of writing, their strong counterparts are actually enforced by the compiler. We will explore how they work, and how using them can improve code quality. We will look at how one can implement a strong typedef by oneself, but also look at some of the readily available implementations which are available.

Finally we will look at how we can handle some special cases, e.g. where we need to allow two different strong types to interact with each other in well defined ways. These could be types representing two different linked quantities like positions and offsets; or scaled versions of the same quantity like different units of length.

Speakers
avatar for Arno Lepisk

Arno Lepisk

Software engineer, HiQ
Arno first came into contact with C++ in the late 90's. After getting a masters degree in engineering physics he has been programming professionally in C++ for over a decade, mostly for different embedded applications within industrial control, defense, gaming, and tele- and data... Read More →


Tuesday September 25, 2018 09:00 - 10:00
Copper Mountain Theater (2nd Floor)

Attendees (190)