Re: Release-mode only falure when comparing STL list::iterator-s
- From: "Ivan Vecerina" <INVALID_use_webform@xxxxxxxxxxxxxxxxx>
- Date: Thu, 13 Apr 2006 12:37:36 +0200
"Tom Widmer [VC++ MVP]" <tom_usenet@xxxxxxxxxxx> wrote in message
news:Oe77OClXGHA.1228@xxxxxxxxxxxxxxxxxxxxxxx
: Ivan Vecerina wrote:
: > The workaround in my application is to use only the first test (ok1)
: > instead of the second (ok2). But what is the reason that ok2 fails
: > in release mode?
:
: It looks like this problem:
:
http://groups.google.co.uk/group/microsoft.public.vc.stl/browse_frm/thread/e61dd3dcdd15f2bf/e6124edd548d7d2d
: and
:
http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?feedbackId=FDBK47862
Indeed, this seems to be a problem with a runtime-check infrastructure
shared by iterators of all containers of this STL implementation.
Quite a nuisance.
I will consider the suggested workaround:
#define _SECURE_SCL to 0
But for now the alternative fix I found will do: compare
the *addresses* of pointed-to elements instead of the
iterators, i.e. (a==b) --> (&*a==&*b)
The most important for me is to know I have no undefined
behavior in my code. I was able to verify this in the
standard. (in the 1998 version of the standard that I
have, this statement appears under 23.1/10:
<< no swap() function invalidates any references, pointers,
or iterators referring to the elements of the containers
being swapped. >>
Thank you Tom for your excellent pointers,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
.
- Follow-Ups:
- Re: Release-mode only falure when comparing STL list::iterator-s
- From: peter . koch . larsen
- Re: Release-mode only falure when comparing STL list::iterator-s
- References:
- Release-mode only falure when comparing STL list::iterator-s
- From: Ivan Vecerina
- Re: Release-mode only falure when comparing STL list::iterator-s
- From: Tom Widmer [VC++ MVP]
- Release-mode only falure when comparing STL list::iterator-s
- Prev by Date: Re: Issue with trying to use wistream
- Next by Date: Re: Release-mode only falure when comparing STL list::iterator-s
- Previous by thread: Re: Release-mode only falure when comparing STL list::iterator-s
- Next by thread: Re: Release-mode only falure when comparing STL list::iterator-s
- Index(es):
Relevant Pages
|