4 ms·
I check them in all of my code because if memory allocation fails I would rather look at recovery options or terminate the program myself gracefully then let th
by Spivak 10y ago
I check them in all of my code because if memory allocation fails I would rather look at recovery options or terminate the program myself gracefully then let the program keep running, performing potentially dangerous operations with bad data, until it fails somewhere down the line.
Sure, maybe that code branch will never get executed but I'll immediately know if it ever does and won't have to try and figure out where the null pointer came from.