Re:How the PVS-Studio Team Improved Unreal Engine's Code
by GFK_of_xmaspast on Saturday June 20, 2015 @11:19AM
(#9750167)
Why is "(GEngine == nullptr || !GEngine->UseSound())" safer than "(GEngine || !GEngine->UseSound())"? Is this some kind of precedence rule, where the former short-circuits but the latter doesn't?
[ Parent
| on HN ]
Re:How the PVS-Studio Team Improved Unreal Engine's Code
by UnquietTinkerer on Saturday June 20, 2015 @11:46AM
(#9750235)
The two conditions are not equialent - the first is true if GEngine is null or does not use sound, and the second is true if GEngine is not null and is undefined otherwise due to dereferencing a null pointer. I assume the original author intended to write "(!GEngine || !GEngine->UseSound())".