Wednesday
Room 4
10:20 - 11:20
(UTC+02)
Talk (60 min)
How to declare a constant in C++
C++ is beautiful in the way that even the simplest things can be unexpectedly challenging and complex. You’d think that nothing could be easier than declaring a constant, right? Choose the most suitable way to define it: a global variable, a local variable, or a static class data member. Maybe a reference. Maybe a template. Set the right linkage and storage duration. Use some combination of specifiers like static, inline, and constexpr for that. Maybe use extern in some cases. How does it play along with module export by the way?.. Oh, and if it's a string, pick the proper type: const char*, char[], std::string, or std::string_view, each of which have their own pros and cons. If all of this is obvious to you — congratulations! That’s impressive. But if, like Mikhail, this whole zoo makes your head spin a bit, let’s try to untangle it together.