Hi,
On Tue, Jan 17, 2006 at 11:16:42AM +0100, Alexandre Julliard wrote:
Aric Cyr Aric.Cyr@gmail.com writes:
Ya, I thought about that after I sent my previous mail as well... an assert would probably be more useful for checking "This". I also disagree that "This" is guaranteed to always be non-NULL. There really is no way you can force policy how a user calls the function, so minimally checking (or aborting) on NULL is a sane thing to do. It doesn't hurt the code, and catches potential usage problems.
Not checking at all and crashing works just as well to catch problems, and doesn't hurt performance. There's no reason to add NULL checks unless there is a Windows app that depends on it.
Exactly! "Stupid" NULL pointer checks even actively hurt debugging since in severe cases you may have a function "properly" (*cough*) failing due to a NULL pointer check, but then "unfortunately" you notice the effect of this "properly checked" anomaly "only" 3 layers and 5000 relay log lines later when something almost entirely unrelated really breaks with a SEGV. Have fun wasting the time to trace back those 3 layers to the real offender...
Andreas Mohr