James Hawkins wrote:
On Fri, Oct 10, 2008 at 2:51 PM, Andrey Turkin andrey.turkin@gmail.com wrote:
James Hawkins wrote:
On Fri, Oct 10, 2008 at 12:59 AM, Andrey Turkin andrey.turkin@gmail.com wrote:
I can't see any value in commented out test or sort-of-meaningless code comment.
The tests serve as documentation of the API. In many cases, that documentation is far superior to even msdn. Just because you know that the implementation matches native doesn't mean that someone else looking to work on the function knows that. He'll then waste time figuring out what you already know. Ask yourself the opposite: what's the harm in adding such documentation?
Non-misleading comment obviously cannot make any harm, and I can imagine one (unlikely but not impossible) case when comment can be helpful so yes, I'll add both commented out tests and sort-of-meaningless comment :) Hopefully nobody will object them.
Please don't add a comment to the implementation. The tests are documentation enough. All you need to do is if(0) out the tests that crash.
Imagine broken application which for some reason, e.g. non-allocated memory, supply NULL to this function, and then catch, eat and spew an exception somewhere in different place. Joe the Developer start searching for root cause - he looks at logs, see first-chance exception, look in CredReadDomainCredentials source and see unguarded dereferencing. Is this intended or mistake? That should code really do? The comment would be handy here (at least for me tests wouldn't be the first place to look at for answers in such situation). I can see the value and cannot see any harm, and frankly I am reluctant to issuing [try4] patch with just another minor comment change.