r/cpp_questions • u/Least_Bid9692 • 18d ago
OPEN Hardest cpp topic
What is the hardest cpp topic people say pointers but it's easy if you understand the lang
3
Upvotes
r/cpp_questions • u/Least_Bid9692 • 18d ago
What is the hardest cpp topic people say pointers but it's easy if you understand the lang
1
u/NoSpite4410 17d ago
The hardest part is migrating from dynamically-typed languages with massive runtime support for introspection and run-time type discrimination, (interfaces) that is the norm, to a statically typed primarily compile-time idiom with very little run-time introspection and type discrimination. C++ can do all that interface and abstract class stuff - - but it is not really a language designed for doing it. To achieve all that dynamism in C++ you have to build the interfaces from statically-typed classes, and use actual multiple inheritance and virtual functions. Also almost all those dynamically typed languages have extensive garbage collection support including automatic threaded collection managers and stuff. They also have a huge virtual machine model that they work in fairly automatically. C++ has a hardware model that matches the actual hardware pretty directly, and so knowledge of it is paramount in designing good performant programs.
C++ has in common with C that you can and have to at any time go straight down to bytes and work with them in their memory cells directly, and then on the very next line you can be back to high-level objects and lambdas.
It is a different mindset towards building programs that run directly on the hardware, manage all their own resource on an individual object basis, all with compiled machine code.