Elektrine lite

← Feed

@LedgeDrop@lemmy.zip

Post #3191685

2026-06-08 10:59 UTC

C++ is useful for learning object oriented programming: Describing what really happens in constructors and destructors, the pros/cons of reference counting and how it actually works (using std::unique_ptr) These are things that most modern languages try to hide/abstract away, but the underlying problems and limitations never go away, but with C++ you’ll have a better understanding of why they happen. However, if you go down the rabbit hole of Template Metaprogramming, I agree with the original post: it takes decades to learn and really only useful exploitable in C++.

Replies (3)

  • @YaBoyMax@programming.dev 2026-06-08 16:24

    I don’t disagree that the language is a great way to build an understanding of object lifecycles, but in my experience C++ ctors and dtors are also the biggest source of confusing footguns I’ve ever encountered in any programming language. Separately, template metaprogramming is a whole different beast. It’s an extremely powerful tool, but to me it also feels like finding the correct incantation to get it to do exactly what you need for more complex scenarios. It can be really fun if you know what you’re doing, but it also tends to make me very upset at the compiler when my incantations are a bit off.

    Open ##3197250

  • @SinTan1729@programming.dev 2026-06-08 11:41

    I’ve always preferred the functional approach to programming, so OOP never really intrigued me. That’s one of the reasons why I never liked C++ or Java, but instantly fell in love with Rust. It lets me do a lot of functional style programming, while still being somewhat practical. (I’m looking at you, Haskell.)

    Open ##3197937

  • @Valmond@lemmy.dbzer0.com 2026-06-09 07:19

    I inherited a supposedly finalised “core” handling data, but only booleans were dealt with and I had to code the other ones. It was coded in template metaprogramming (MSVC & gcc 4.8 😨), just thinking about it gives me chills down the spine! It’s a bit fascinating (and your normal template problems if you have any will vanish and your loved one will return) but it’s, IMO, not for large projects 😬. Impossible to debug (not every error is caught compile time after all). printf was coded like that (with the variadic template “…”), I don’t remember if it was libraries for the old compilers or the new ones… But that’s a fun way of checking it out IMO!

    Open ##3216358