Tag: pointer
5 posts
-
C++ Slicing Bugs: Finding Where a Base-Type Copy Dropped Your Derived Object
How C++ object slicing silently drops derived data in by-value parameters, vector<Base>, catch by value and base assignment, and how to make it a compile error.
-
C++ nullptr vs NULL: The Overload Bug NULL Causes and What std::nullptr_t Fixes
Why C++11 replaced NULL and 0 with nullptr: the overload bug NULL causes, what std::nullptr_t is, nullptr in templates and APIs, and migrating old code.
-
C++ this Pointer: Chaining, const Methods, Lambdas, and CRTP
The implicit this pointer in non-static member functions: disambiguation, method chaining, self-assignment checks, lambda captures.
-
Stack vs Heap in C++: Why Deep Recursion and Big Locals Overflow, and When to Allocate
C++ stack vs heap: stack overflow from deep recursion and huge locals, memory layout, performance, new/delete, smart pointer lead-in—Valgrind.
-
std::optional vs Nullable Pointer vs Out-Parameter in C++: Choosing How to Return 'Maybe a Value'
std::optional vs T* vs out-param in C++: who owns the result, optional<T&> before C++26, value() vs operator*, optional<bool> traps, dangling lookups.