The joy of pedantic people - hunting down "TODO:" comments in code ;-)
Because of the recent organizational change we inherited a new code base consisting mainly of C# code. When it comes to the unmanaged code then I usually do the following before even reading any lines of new inherited code:
- Make sure that code compiles cleanly with
/W4, /Wp64, and /WX.
- Enable the following compiler options (if not enabled already):
/GS and /RTC1. Then run some subset of tests on the new build in hope of seeing some errors.
- Run PREfast or PREfix on the code base and look through every single warning.
With managed code it’s not so easy anymore. Half of the problems typical to C/C++ family of programming languages are suddenly gone. It’s not so straightforward to point out mistakes in other people’s code anymore. But the wickedness in me couldn’t rest and after some brainstorming I suddenly had it!
findstr /s /n /c:"TODO:" *.cs
In our group we open a bug per every "TODO:" comment in the code to make sure that everything is accounted for and nothing gets away before shipping. Quick search in bug database showed that I was the first one to stumble across this and more than twenty bugs later I’m feeling that today was a good day ;-) Sometimes there’s only so much needed for happiness.
On the other hand, if a couple of years ago somebody would have pointed out these "TODO:" comments in my code then I would have definitely answered: “Those who can, do. Those who can't, just complain about other people’s code.” Life is strange sometimes.