James Hawkins wrote:
On Fri, Oct 10, 2008 at 3:17 PM, Andrey Turkin andrey.turkin@gmail.com wrote:
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.
You just said that the tests crash in Windows. If the tests crash in Windows, then how does this app work there either? That's the point of tests: to verify that our implementation matches native.
We know my implementation and Windows implementation behave identically and this is documented in tests. At this point you and me both happy about the comment in tests and tests in general, right? Now back to the example. In this example something somewhere went wrong because of Windows/Wine differences, e.g. previous memory allocation failed or something. Completely unrelated to this particular function, and our Joe should not spend his time trying to understand the function itself - and code comments do just that. Joe read the comment, understand that NULL pointer should not be passed in the first place, and continue his quest. Sounds useful for me, and certainly looks harmless (apart from causing this thread to go on).