h8CplusplusGuru said:
taby said:
Oh, and if you’re using pointers (other than function pointers), you’re doing it wrong.
What's wrong with using pointers?
You should prefer to use references over pointers, for any variable where the address can neigther be nullptr nor change. Thats my main criticism of UE4 for example - everything is returned by pointer even if the object is guaranteed to exist, meaning you never know if a nullcheck is needed or not (without fully reading and understanding the source). If on the other hand, you have a codebase where pointers are exclusively returned by functions when the return-value might be a nullptr, its obvious which return-values need to be checked (and there should be way less when everything else is returned by &).