CppCon 2017: Scott Schurr “Type Punning in C++17: Avoiding Pun-defined Behavior”
http://CppCon.org — Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/CppCon/CppCon2017 — Type punning, treating a type as though it is a different type, has a long and sordid history in C and C++. But, as much as we'd like to deny its existence, it plays an important role in efficient low-level code. If you've ever written a program that examines the individual bits of a pointer or of a floating point number, then you've done type punning. Given its long legacy, some of the techniques for type punning that were appropriate, even encouraged, earlier in history now live in the realm of undefined behavior. We'll identify which techniques are now proscribed and postulate why. We'll also explore ways to do type punning in C++17 that sidestep undefined behavior and are hopefully as efficient as the older techniques. In this session we will look at: o Common (and some uncommon) motivations for type punning. o Techniques for type punning, both good and bad, all ugly. o Related topics (like type conversions and std::launder()) with an eye toward unspecified and undefined behavior. — Scott Schurr: Ripple, Senior Software Engineer If you ask his children, they will tell you that Scott has been writing software since dinosaurs roamed the earth. In 1996 Scott learned C++ by working through the exercises in Stroustrup's TC++PL 2nd edition and he has never looked back. Scott is currently working at Ripple Labs developing open source crypto-financial software. When he's not writing code Scott plays the Chapman Stick, sings rock and roll, and spends time with his lovely wife. — Videos Filmed & Edited by Bash Films: http://www.BashFilms.com Work at Hudson River Trading (HRT): https://tinyurl.com/safxfctf --- Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
Download
0 formatsNo download links available.