3 ms·
Modern C++ is fairly easy to learn. At-least easier than either Rust or C.
by lenkite 6y ago
Modern C++ is fairly easy to learn. At-least easier than either Rust or C.
- XCSme 6y agoI 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.
- AlexCoventry 6y agoI've written 5-line C++ programs which have stumped experts for hours. There's a trilogy of books about all its edge cases and best practices for working around them... C++ still has a place, but not as a beginning systems language.
- lenkite 6y agoI hope we never judge how easy is it to learn and use a programming language by obfuscated code contests. All languages will fail by that measure in their lifetime as they accumulate cruft.
- AlexCoventry 6y agoThis wasn't obfuscated code. This was a MWE, where I was trying to understand why it wasn't working as expected.
- Kuraj 6y agoThis language is so extensive and seemingly has so many dialects that I find it really hard to make sure that what I'm learning is modern C++. Can you recommend any literature?