Re: Release-mode only falure when comparing STL list::iterator-s



"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


.



Relevant Pages

  • Re: Was bedeutet [[ expression ]]
    ... die Nutzung von unportablen Konstruken, ... funktionieren als dieser Workaround, zumindest ist das meine ... Siehe ISO/IEC Standard 9945 sowie IEEE Standard 1003.1-2001 aka Single ... UNIX Specification Version 3 Shell & Utilities -> test ...
    (de.comp.os.unix.shell)
  • Re: openssl 0.9.7e make fails with "Argument list too long"
    ... you can up the ridiculously low number for ARG_MAX in ... Of course there is probably some workaround possible within the port, ... and it really should build with a standard kernel - after all, ...
    (comp.unix.bsd.freebsd.misc)
  • Generic Arrays
    ... generische Arrays zu erzeugen. ... wissen möchte, ist, ob es einen "besseren" Workaround als folgenden ... oder ob der "Standard" ist: ...
    (de.comp.lang.java)
  • Re: SqlDecimal inconsistencies with Decimal
    ... > We have found some rather odd behaviour in the SqlDecimal type, ... > standard Decimal type. ... > direction of a workaround or fix. ... > Sub Main ...
    (microsoft.public.dotnet.framework)
  • Re: Multithread select() bug
    ... but only as a workaround (and not a universally ... > completely misunderstood the various references). ... that fits the standard description. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)