3 ms·
Sure, but the bug in this case is that there wasn't a comment specifying the reason for the unconventional behaviour.
by StavrosK 15y ago
Sure, but the bug in this case is that there wasn't a comment specifying the reason for the unconventional behaviour.
- scott_s 15y agoI agree. If you know you're writing something that is un-idiomatic or you think its intended purpose will be a surprise to most readers, put a comment in explaining why. // we need a heap object so we can synchronize on it later Boolean b = new Boolean(true);
- cdmckay 15y agoI'd also make the name a bit more descriptive.
- groby_b 15y agoThis points to a deeper problem of static analysis, though - any analysis package without the ability to annotate code is _doomed_. The false positives will be so annoying that people will give up on it. And for the people who work on SA systems - please give me a way to annotate that is not exclusively via comments. Especially once people use multiple SA packages, that is rather annoying :)
- plasma 15y agoDon't forget the OpenSSL "bug" (using uninitialized memory) that was really on purpose, resulting in a critical flaw once changed. In that instance too, lack of commenting to explain the behavior was also at fault.