[CoinUtils] Bug or no bug? (VS2010 & null pointers)
Lou Hafer
lou at cs.sfu.ca
Wed Mar 9 22:34:36 EST 2011
Folks,
Those of you on the last TLC telecon will recall I mentioned that
the CoinUtils unit test triggers a VS assert when built in debug mode in
VS2010. Here are the details. The question: Is this our bug, or a bug in
MS's debug library.
A CoinShallowPackedVector object contains pointers to vectors of
elements and coefficients. The default constructor sets these attributes
to 0. CoinShallowPackedVector::operator== contains the following call:
std::equal(getIndices(), getIndices()+getNumElements(), rhs.getIndices())
For an empty vector, this will resolve to std::equal(0,0+0,0). Some
sample code is attached that will trigger the assert in a debug build
and run just fine in a release build. I'll point out that VS2010 is the
firstplatform I know of that has this problem.
The VS debug libraries contain lots of useful code to catch errors,
so I'm reluctant to bludgeon VS into submission by defining compile-time
symbols to remove the checks. I was just going to just report this as a
VS bug, but it's arguable. (As a technical defense, the MS documentation
does state that all pointers must be dereferenceable.) So I'm putting it
out to the community. Opinions? Is this our bug, or Microsoft's bug?
Lou
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dbgiterator.cpp
Url: http://list.coin-or.org/pipermail/coinutils/attachments/20110309/719e2b6d/attachment.pl
More information about the CoinUtils
mailing list