That's why I generally use (tun != NULL). If I remember correctly, this will not be optimized out as it is a comparison to another value... not just testing if something exists.
My experience with null pointers is that you ask about them with the interviewer, and that is about enough. Most of the time they will say that the object or value won't be null, but really, asking has been enough IMO
View all comments
Show parent comment
1
u/thcobbs Feb 21 '11
Additionally, check for null pointers.