   Debugging help please...
  Sometimes when running my program when I'm in debug mode and my program stops at a debug point, then I click on the VC++2008 editor my program crashes. It never crashes when I run the .exe, anyone else get this? It does not happen at any specific time or in the same place in my program.Any ideas on how to debug it...Is there a good way to debug if an array is called outside it's range i.e. int  temp[5];temp[5]=1;Also, is there a decent way to debug if when using Bitblt, you accidently blit outside of the screen area,i.e. if screen size is 1900x1200BitBlt(hdc, 1800, 0, 200, 0, hdcMap, 0, 0,  SRCCOPY);These are the type of bugs I routinely find (but with many variables changing) and could be still in my program but would take way too long to go through every iteration and combination to ensure it won't happen manually... any ideas on how to find these type or other "common" bugs would be appreciated...I have precautions all over the place to ensure it doesn't happen, but in the end it still does - must be when I'm really tired...i.e. ScreenWidth=1900;if (a>ScreenWidth) a=ScreenWidth;Thanks for any ideas/suggestions...rhuala   
  - Sounds like warped memory but that's a new one for me.- Use a std::vector or std::tr1::array[edit] I should clarify... if you go outside of the range, the program will either break on assertion or throw an exception to let you know what happened. [/edit]- You could wrap BitBlt, do some assertions in the wrapper so it breaks to the code if you're outside the bounds, and "replace all" your current BitBlts to the new wrapped version... call it BitBltChecked or something.  This would allow you to change how it handles going outside the clipping area in one single place, as well as many other advantages.Cheers-Scott[Edited by - popsoftheyear on January 23, 2009 3:32:35 PM]