For the last ten years Gimpel Software has posted a short stand alone program with an obscure C bug in it, with the challenge to the reader to figure out the bug.
Gimpel does this to show off their static analyzer Lint, the nitpickyest of all programs, something that I use almost daily. Lint exposes bugs by looking at a project as a whole, with multi-pass value tracking, rather than just as a file at a time as most humans would. Lint also can test for compliance with various guidelines such as MISRA or The Barr Group's Embedded C Coding Standard.
You can even input your own bugs to test short snippets of code that you might come across. For example the abysmal "if( A==B==C )" found in some of Freescale's USB stack code (I'll save the rant on poor manufacture example code for an other time).
I always looked forward to the challenge of the Bug of the Month, sadly it has be discontinued in favor of a new blog (May not be operational until late summer). I really don't like how everyone thinks replacing something useful with something akin to 'Social Media' is a good thing, how about you?
Colleagues over the years have complained that Lint puts out to many warnings. That is usually the case of Linting legacy code. Error messages may be turned off in layers. Get rid of the ones that will crash the system first, followed by the ones that might, until you get down to none or the ones you are willing to live with. Also with people trying to turn serious development in to some kind of game, see Development has become the game. Whats your Potty Mouth Score today?, make Lint a game. Can you write code that will give no Lint errors today?
No comments:
Post a Comment