Why does this crash in release version but not debug?

This is a discussion on Why does this crash in release version but not debug? within the C++ Programming forums, part of the General Programming Boards category; for (tempOffset[0] = entireLine.Find('<', tagOffset[0]), tagOffset[0] = tempOffset[0]; tagOffset[0] != -1; tagOffset[0] = tagOffset[1], tagOffset[1]++) ... Why would the above ...

  1. #1
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802

    Why does this crash in release version but not debug?

    for (tempOffset[0] = entireLine.Find('<', tagOffset[0]), tagOffset[0] = tempOffset[0]; tagOffset[0] != -1; tagOffset[0] = tagOffset[1], tagOffset[1]++) ...

    Why would the above code crash in release but not debug? It worked fine in debug.. then when I compiled release... it doesn't.
    I ended up changing it to a while(1) and did all the testing internally... but I'm still curious; why?

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    552
    I hate it when that happens. Debug versions of certain memory functions (such as new and delete) often have different versions for debug and release mode. Usually though its a problem with your code that just happens to not cause a crash in debug mode. Most of the time when that happens to me its usually because im writing outside of my declared memory, so check, double-check.... and re-check your arrays

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Nub question on debug version
    By abachler in forum Windows Programming
    Replies: 3
    Last Post: 08-08-2007, 11:46 AM
  2. _beginthreadex does not complile
    By Devil Panther in forum Windows Programming
    Replies: 22
    Last Post: 12-13-2006, 07:51 AM
  3. How to set File Version of VC++ 6 dll
    By mercury529 in forum Windows Programming
    Replies: 3
    Last Post: 12-08-2006, 02:49 PM
  4. Debug vs Release
    By tao in forum Windows Programming
    Replies: 4
    Last Post: 07-10-2006, 01:27 PM
  5. Why does this program crash at run-time
    By meys in forum C Programming
    Replies: 2
    Last Post: 10-18-2001, 05:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21