I’m new to C++ programming and discovered that even IsValid
can cause a crash if you haven’t initialized a pointer at all. I have a struct with pointers as function arguments, and I didn’t declare where to pass the variable. It might pass even a simple check (Pointer != nullptr
) and return true because it’s not nullptr
, but it’s also not a valid pointer — I don’t know what it is. So, initializing structs with pointers to at very least make them nullptr
seems like a very good practice, I suppose?