Iterator Debugging
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Iterator Debugging

Threaded View

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,256

    Iterator Debugging

    One of my apps links to a DLL which uses the standard containers (std::vector etc). I recently noticed that my compiler (VS2005) has an option to build with iterator debugging. From what I can gather, this option enables a warning to get generated if I try to use an invalid container iterator (e.g. if I deleted an item from a container but then carried on using an existing iterator). I'm not sure if the warning appears at compile time or run time but either way, it seemed like something that would be worth having.

    I read somewhere that for this to work, I also need to enable checked iterators. So AFAICT I should be able to use iterator debugging simply by adding these two preprocessor directives to my Debug build:-

    Code:
    _SECURE_SCL=1
    _HAS_ITERATOR_DEBUGGING=1
    I have the source code available for both the main app and the DLL - so I added those preprocessor directives in both cases and re-built. But now, when I try to launch the app I get this error and the app refuses to start:-

    The application failed to initialize properly (0x0c150002). Click on OK to terminate the application.
    If I redefine the 2 preprocessor directives to zero, the app starts working again. So I guess there's a bit more to this than I realised. Can anyone give me a hint about what I might have missed?

    Interesting development - I looked in the file yvals.h and from what I can tell, _SECURE_SCL and _HAS_ITERATOR_DEBUGGING are already defined to 1 for a Debug build. And yet if I specifically define them to 1, I get this strange run time error
    Last edited by John E; March 6th, 2013 at 06:12 AM.
    "A problem well stated is a problem half solved. - Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center