Lightning Talks: -std=c++20 -- Will This C++ Code Compile? - Tulio Leao - CppCon 2022

preview_player
Показать описание
---

Lightning Talks: -std=c++20 -- Will This C++ Code Compile? - That is the Question - Tulio Leao - CppCon 2022

New versions of the standard come and go and every team takes its time to adopt them, C++20 being no different. Come see some compilation issues found when porting to C++20 and ways to solve them for when the times come for yours!
---

Tulio Leao
---

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

From experience, turning on C++11 for the first time (due to many reasons) and later 17 (mostly due to deprecation of things) broke way more in our large codebase than 20 did. I've only seen small things when enabling 20 in Visual Studio which were more due to different compiler behavior than due to actual changes in the standard. Usually in the undefined behavior area; bits of code that were missed during reviews.

ruadeil_zabelin
Автор

Why is committee holding out features for sake of backwards compatibility when most major version break the existing code anyways. Why even update your code to newest standard ?

Antagon
Автор

Thank God they removed the construct and destroy methods from the default allocator. If you wanted to write your own allocator aware contiguous containers from scratches before you couldn’t use the std::uninitialized_* algorithms because the standard dictated that the allocator’s construct/destroy methods had to be used when defined and there was no reason for the default allocator to have these implemented because they weren’t doing anything special other than calling placement new.

For optimal code gen with calls to memset and memcpy you had to statically check that the allocator was either not implementing construct/destroy or that it was a specialization of the default allocator, now you only need to check for the first condition.

cristian-sigb
Автор

Is last one even a thing? cppreference on std::accumulate says it used std::move since C++11 and it's in that's page edit history that they changed it from "since C++20" to "since C++11" so talking about changes from 17 to 20 only constexpr added

majohime