News for hackers. Stuff that matters.
Re:CppCon 2022 by oriolid on Saturday September 17, 2022 @11:44AM (#32878425)
Just asking because I'm curious: What are the parts of C++ that you actually use? To me RAII and managed pointers are by far the most useful features in C++, followed by templates (think of them as type safe macros with slightly less horrible syntax, not as generics).
Re:CppCon 2022 by rsaxvc on Saturday September 17, 2022 @12:23PM (#32878747)
Not the commenter but embedded embedded here so my perspective is a little different.

For me, constexpr for resolving complex build-time logic into constants, cleaner type handling for the math library makes it harder to accidentally pull in a 64-bit libm when we only have a 32- it FPU, and templating for sure.

It's pretty easy in C to reach a point where macros of macros is madness but templates calling templates still works with the debugger and is a powerful mechanism for hoisting complexity out of loops. Also works nicely for writing outer loops once in c++ calling a template specialized to either inline assembly or c++.

Managed pointers sometimes but our team seems pretty good with object lifetimes from a C background, and we don't use too much heap anyway.

RTTI and exceptions we often disable to save code space.

RAII is a little tricky without exceptions, we often use it's easy.

Re:CppCon 2022 by oriolid on Sunday September 18, 2022 @05:24PM (#32891631)
Good point about embedded, smart pointers aren't that great when you try to avoid allocating memory at runtime and never free it anyway. RAII is still useful for managing other lifetimes, though. The last time I worked on embedded stuff the compiler we used generated often larger code for constexpr, so we didn't really use it.
Re:CppCon 2022 by intelVISA on Saturday September 17, 2022 @01:50PM (#32879575)
About the same here: RAII > smart pointers > constexpr > templates > coro in that order.
Re:CppCon 2022 by 5636553454654 on Saturday September 17, 2022 @07:14PM (#32882567)
This is similar to me. As far as modern stuff, I'm willing go upto c++20, and I use smart pointers, templates, constexpr, RAII, and STL.

With templates, I use them for generics, but also judiciously to create meta-linguistic abstractions to get around certain limitations of language. For example, I built an ORM using them.

I don't use auto, or lambdas, or even foreach (I use iterators), despite oddly having much more dynamic language experience.