Continue reading "Ditch Your C-style Pointers for Smart Pointers"
Ditch Your C-style Pointers for Smart Pointers
Similar to my recommendation to ditch your built-in arrays, it's time to ditch your basic raw pointers for C++ smart pointers. Using raw pointers leave you susceptible to a variety of bugs: Memory leaks Freeing memory that shouldn't be freed (e.g. pointer to statically allocated variable) Freeing memory incorrectly - free() vs aligned_free(), delete vs …
