[Insight-users] ITK and iterators debugging in Visual Studio 8
Karthik Krishnan
karthik.krishnan at kitware.com
Wed Dec 27 15:29:33 EST 2006
On 12/27/06, Matei Stroila <matei.stroila at gmail.com> wrote:
>
> Yes, here it is:
>
> Expression: vector iterators incompatible"
> Line 170: same = (m_Index == region.m_Index);
This is a perfectly valid error (at least from VS8 perspective).
Following is a the code snippet that throws this error.
#if _HAS_ITERATOR_DEBUGGING
void _Compat(const _Myt& _Right) const
{ // test for compatible iterator pair
if (this->_Mycont == 0 || this->_Mycont != _Right._Mycont)
{
_DEBUG_ERROR("vector iterators incompatible");
_SCL_SECURE_INVALID_ARGUMENT;
}
}
#endif /* _HAS_ITERATOR_DEBUGGING */
What this says is that its illegal to :
1. Compare a null iterator (of course)
2. Compare two different container objects. (why ? don't ask me.)
It is therefore natural for the error to be thrown in line 170 of
itkImageIORegion.h
same = (m_Index == region.m_Index);
because you are comparing two different std::vector objects. I would suspect
that comparison is being done in line 96 of itkImageFileWriter.txx .
The fix would be to
1. write our own macro in itkMacro.h to compare two std::vector objects. (if
we care about debugging with VS8.)
Or
2. Set the flag _HAS_ITERATOR_DEBUGGING=0 flag by default when the ITK
library is compiled.
Please log this issue as an entry in the bug tracker.
> > Even if I define _SECURE_SCL=0 and _HAS_ITERATOR_DEBUGGING=0 in my
> > > project,
> > > I still cannot use ITK in debug mode, since I keep getting run time
> > > errors related to the iterator debugging.
Remember. You need to recompile ITK (every library you use), if you change
any of these flags.. I suspect you did not do so.
PS:
Please read
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/VisCExSecApps.aspto
see a list of the security features in VS8.
Thanks
-karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20061227/cb726bb5/attachment-0001.htm
More information about the Insight-users
mailing list