On Fri, Apr 20, 2012 at 3:06 PM, Filip Pizlo <fpi...@apple.com> wrote: > Someone in this thread said something about code readability. So let's > consider that. If I see code like: > > if (!var) thingy(); > > Then I will be under the impression that var might sometimes be zero and > that thingy() might sometimes happen, and that the previous webkittens to > touch this code had a good reason for this check. > > Coverity is no more accurate than testing; if it tells you that var might be > zero than it cannot, will not, and does not give you 100% confidence that > this is reachable. > > Hence if you add special cases for things that coverity warned you about, > you are potentially doing a disservice to anyone looking at the code in the > future. You are telling them that "var might be zero" when really you meant > to say "I put in this check to get my tool to stop complaining". > > On the other hand, if you are able to construct a test that demonstrates > reachability then you win. But if there is no test then see my previous > paragraph.
Wouldn't an ASSERT be more helpful in this case, i.e. something like: ASSERT(var); thingy(); Does ASSERT make coverity stop giving out warnings? _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev