"Bjarne Stroustrup, the inventor of C++, defines the zero-overheadprinciple like this: " – pg. 4
"What you don't use, you don't pay for."
"What you do use, you couldn't hand-code any better."
linked_list.c | linked_list.cpp
- Commpilation (JIT vs direct compilation)
- Memory management (garbage collection vs manually or reference-counting methods)
- Memory allocation (individual heap allocations vs finer control over individual or bulk stack / heap allocation for greater contiguity)
"The C++ type system gives us the ability to explicitly state the ownership of an object" – pg. 9
"In the C++ version, the programmer states that the toppings are completely encapsulated by the Bagel class" – pg. 10
"Const correctness means that each member function signature of a class explicitly tells the caller whether the object will be modified or not; and it will not compile if the caller tries to modify an object declared const" – pg. 11
"Except in very rare situations, a C++ programmer should leave the memory handling to containers and smart pointers, and never have to rely on manual memory handling." – pg. 12
"The destruction of objects is deterministic in C++. That means that we (can) know exactly when an object is being destroyed" – pg. 13
"Deterministic destruction is also one of the features that makes C++ predictable; something that is highly valued among programmers, and a requirement for performance-critical applications." – pg. 13
"C++ arguments passed as references indicate that null values are not allowed:" – pg. 14
"C++ arguments passed as pointers indicate that null values are being handled:" – pg. 14
- Initial complexity of the language
- Longer compile times
- Importing of libraries (headers, although now we have modules in C++20)
- Lack of provided libraries (compared to the likes of numpy or itertools in Python – handy, but not a big deal)