4 ms·
C++ is a multi paradigm language, it is not “object oriented” necessarily. also, there is nothing wrong with C++. it’s C with additional language constructs an
by b20000 5y ago
C++ is a multi paradigm language, it is not “object oriented” necessarily.
also, there is nothing wrong with C++. it’s C with additional language constructs and the STL. use as much or as little as you want of it.
also, there is no such thing as leaking a pointer. you can leak a piece of memory.
at the end of the day you need to understand operating systems and how memory management, CPUs and instruction sets work and lots of other low level stuff to build software using C or C++. Rust might temprarily help with some challenges or shield off certain otherwise advanced challenges but in the end there is no way around learning how the machine you write software for works. if you don’t want to deal with that, go build websites.
- throwaway5486nv 5y agoWhat other paradigms are popular with C++? Never came across anything else other than object programming.
- Jtsummers 5y agoGeneric, functional (with the introduction of lambdas and closures, in particular), procedural. Some of the features may use the class system under the hood, but with a very shallow hierarchy it's more akin to a trait/interface system if you drop the deep class hierarchy style that was more prevalent in the 90s.
- throwaway5486nv 5y agoAre there any popular open source projects that has adopted non object oriented programming style?
- Jtsummers 5y agoI'd just look at the C++ Standard Library which relies far more on the procedural, generic, and functional styles than OO. Using it, you often (IME) end up writing code more along the trait/interface style than the OO-hierarchy style that was popular in the 90s. But I have no idea about open source C++ projects, I don't follow them and mostly don't care. I've really only used C++ at work where 99% of the code seems to be procedural, not OO. The closest is that they have "classes" which are barely more than plain data objects ("smart" structs), if they have methods it's to enforce data invariants and almost nothing else.
- Animats 5y agoLeaking a pointer occurs when you take a raw C pointer from one of the safe templated C++ constructs. This happens far too often because there are so many C APIs around that are still used from C++.