Today when I was browsing the MSDN VC++ forum, I saw a post asking the differences between “Start with debugging” and “Start without debugging”.

The original post is:

I’m having a problem with a network application I’m coding. I have this connection between a client and a server that only works when I start my application with “Start with debugging” and never with “Start without debugging”, both in Debug and Release configuration.

So my question is : what’s the differences with “Start with debugging” and “Start without debugging” that could possibly change the behaviour of a program? Because I don’t have a clue as of where to search for the problem… If it can help, my program is multi-threaded.

 

I also had the same question several years ago.

This issue is caused by the different variable initialization behavior of differnt run modes.

In the “Start with debugging” mode, the un-initialized variables are set to the default values. But in the “Start without debugging”, the variables are left random.

For example, you have:
int iHowMany;

In the “Start with debugging” mode, iHowMany is initialized to 0. But in the “Start without debugging” mode, the value of iHowMany is random.

It is easy to find all the un-initialized variables. The VC compiler generates a warning for using an un-initialized variable. Just go through the compiler warning list, find them and initialize them.