4 ms·
I personally don't think this is true. I worked a lot with C++ before and I'm still confused by the syntax and logic behind some concepts like (just randomly se
by XCSme 6y ago
I personally don't think this is true. I worked a lot with C++ before and I'm still confused by the syntax and logic behind some concepts like (just randomly selecting some links from the dynamic memory group).
https://en.cppreference.com/w/cpp/types/remove_extent https://en.cppreference.com/w/cpp/types/remove_extent
https://en.cppreference.com/w/cpp/memory/shared_ptr https://en.cppreference.com/w/cpp/memory/shared_ptr
https://en.cppreference.com/w/cpp/memory/polymorphic_allocator https://en.cppreference.com/w/cpp/memory/polymorphic_allocat...
I think the basics that are similar to other languages (data types, basic pointers, basic references, classes and OOP) are indeed easy to learn as they are basically the same in most programming languages, but the more specific memory management and weird syntax around some standard libraries make it harder to learn, use and read. Let's be hoest, correct C++ code usually looks ugly and verbose.
- lenkite 6y agoshared_ptr is fairly understandable at-least from an application developers usage point of view. std::remove_extent is only used for template metaprogramming and generally in linear algebra libraries. polymorphic_allocator is an expert facility. Apart from shared_ptr, the other two are for very specialised purposes - 99.9999% of all C++ code ever written will never have them. But if you need them, you can leverage them. I came from high level languages (JS/Java) and I found modern C++ pretty good - wow I can code native!. I found writing in plain C very difficult and laborious. I found Rust conceptually far more difficult than C++. Also you can't take your traditional data structures and write them in Rust. You have to do it the special Rust way, which makes it a plain when you are just trying to follow the code/pseudocode in a paper. Admittedly, the Rust compiler catches pretty much everything you do wrong. But I code C++ with all warnings treated as errors along with static code analysers and they catch all my mistakes too.