Embracing PODs Safely Until They Die - Alisdair Meredith & Nina Ranns - CppCon 2021

preview_player
Показать описание
---
How do you change the active member of a union? Can you copy an object without a publicly callable copy constructor? Can you pass classes having private data to a function implemented in C? What is the use case for the library type trait `std::is_trivially_move_assignable`? All these questions and more will be answered in this session.

PODs --- Plain Old Data --- are neither plain nor old in C++11, and continued to evolve in every published standard since, until they were finally banished in C++20. In researching the deconstruction of PODs for the upcoming book, "Embracing Modern C++ Safely" Alisdair Meredith (and the other authors including John Lakos, Vittorio Romeo, and Rostislav Khlebnikov) discovered that many of the intuitive properties and capabilities of trivial and standard layout types did not behave quite as expected, and there are many subtleties waiting to catch the unwary. Nina Ranns, as an active member of the Core working group, stepped in to explain and resolve many concerns, while pointing out further bad assumptions. Together they will present the use cases, pitfalls, and annoyances of these features as now properly understood, giving a flavor of the presentation style of each of the 57 C++11/14 features presented in the book.

---

Alisdair Meredith
Alisdair Meredith is a software developer at BloombergLP in New York, and a previous chair of the C++ Standard Committee Library Working Group. He has been an active member of the C++ committee for almost two decades, and by a lucky co-incidence his first meeting was the kick-off meeting for the project that would become C++11, and also fixed the contents of the original library TR. He is currently working on the BDE project, BloombergLP's open source libraries that offer a foundation for C++ development, including a standard library implementation supporting the polymorphic allocator model that was ultimately adopted by C++17.

Nina Ranns
Nina Ranns has been a member of the C++ standard committee since 2013, focusing mostly on the core part of the language, and committee secretary since 2018. Throughout her career she has worked for Siemens, Motorola, Datasift, and Symantec on everything from parts of the UMTS network to cloud based antivirus products. Currently an independent consultant with contracts for EDG, QT, and most recently Bloomberg, where she is eagerly extending her library knowledge and helping create new polymorphic-allocator friendly library types.

---

Рекомендации по теме
Комментарии
Автор

According to Amazon "Embracing Modern C++ Safely" is 1376 pages long. It's almost as long as the Standard itself!

alexeiz
Автор

thanks for this video. Unfortunately, the audio quality is poor though

polyakovartem
Автор

Definitely need to push hard on audio quality for online conference presentations going forward. Perhaps make a minimum standard for audio capture (room conditions and audio equipment) a requirement for acceptance of a talk.

AndrewHelgeCox
Автор

42:05 "a classic technique"? Shouldn't we be using (and teaching) the use of std::addressof there? (Or should it be std::pointer_to? Hmm confusing.) Having to use an arithmetic operator seems a bit outdated.

jhbonarius
Автор

Regarding the trivially copyable/copy constructible pitfalls (arguably: mess?), another quirky example is that whilst a class with a &&-qualified explicitly-defaulted copy assignment operator (S& operator=(const S&) && = default;) qualifies as trivially copyable, it does not qualify as trivially copy assignable.

davidf
Автор

17:30, why not just put some f() in public, to give a copy? Would it lose its standard layout status?

MrAbrazildo
Автор

59:40 std::variant is a safer (though more memory consuming) alternative to union

Roibarkan