/*
* get a list of guids
* for each guid
* if it is not GUID_NULL
* do stuff
*/
vector<GUID> guids = getGuids();
for (vector<GUID>::iterator i = guids.begin(); i != guids.end() && *i != GUID_NULL; i++)
{
// do stuff
}
I wrote the above code that meant to achieve the result in the pseudo code. Surprisingly (or fortunately) my testing code failed. I should not have evaluated the GUID_NULL condition in the loop-test. So here is the corrected code.
vector<GUID>: guids = getGuids();
for (vector<GUID>:::iterator i = guids.begin(); i != guids.end(); i++)
{
if (*i != GUID_NULL)
// do stuff
}
well, this was a very basic logic error, I could only blame my hurting brain after a long day of coding. anyway, unit testing rocks.
Print | posted on Wednesday, September 12, 2007 12:01 AM