A small bug database
bearophile
bearophileHUGS at lycos.com
Sun Oct 21 12:55:59 PDT 2012
The idea of creating a bug data base is interesting. This little
data base collects only the bugs found by the PVS-Studio static
analysis tool in Open Source projects:
http://www.viva64.com/en/examples/
- - - - - - - - - - -
I have added some examples of bugs in my "Require
parenthesization of ternary operator when compounded" enhancement
request:
http://d.puremagic.com/issues/show_bug.cgi?id=8757
This is a common enough bug, worth avoiding with a change in D
design (but it's a small breaking change).
- - - - - - - - - - -
>The return value of function 'xxxxx' is required to be utilized:<
http://www.viva64.com/en/examples-V530/
In D there are several Phobos functions like empty() that have no
side effects, so ignoring their return value is sometimes a bug.
In GNU-C there is a function attribute named "warn_unused_result":
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
In D a @warn_unused_result is maybe handy for functions like
empty().
- - - - - - - - - - -
http://www.viva64.com/en/examples-V564/
It's mostly about the (!x & y) bug pattern, that is not yet
forbidden in D:
http://d.puremagic.com/issues/show_bug.cgi?id=5409
- - - - - - - - - - -
http://www.viva64.com/en/examples-V588/
This is about the "=+" and "=-" bug patterns. Not very common but
easy to spot.
- - - - - - - - - - -
Bye,
bearophile
More information about the Digitalmars-d
mailing list