From: K�r�at on
Hi,

While I debugging an appliation I noticed an interesting nuance. If I build
the application with Debug configuration and then successively call a
function, the local variables of that function is not preserve their
previous values. But If I build with Release configuration and do same
things then the result is interesting: local variables preserve their
previous values as if they static. What is the difference?


From: David Wilkinson on
"K������������������" wrote:
> Hi,
>
> While I debugging an appliation I noticed an interesting nuance. If I build
> the application with Debug configuration and then successively call a
> function, the local variables of that function is not preserve their
> previous values. But If I build with Release configuration and do same
> things then the result is interesting: local variables preserve their
> previous values as if they static. What is the difference?

K:

This is implementation detail of VC.

In release mode, local variables are not initialized, so variables may or may
not retain their values.

In debug mode, variables are initialized to special values, so the old values
are always destroyed.

--
David Wilkinson
Visual C++ MVP