News for hackers. Stuff that matters.
Re:Null Pointer Dereferencing Causes Undefined Behavior by pjmlp on Tuesday April 21, 2015 @07:07AM (#9413240)
The problem is that "correctness before performance", traditionally hasn't been part the C culture.
Re:Null Pointer Dereferencing Causes Undefined Behavior by DominikD on Wednesday April 22, 2015 @10:36AM (#9420707)
There's no performance penalty here. The only difference is that you're on the safe side if you don't dereference before the null check. Whether discussed case is UB or not, compilers I've tried (MSVC 2013, GCC 4.9.something) produce the same code in both cases.