Re: Problem only in release version!

Tech-Archive recommends: Speed Up your PC by fixing your registry



>the Debug version initializes most variables to zero.

In another bid to dispel this myth - a debug build doesn't do this.

In newer versions of VC++, the compiler has run-time diagnostic
options that will initialise automatic (stack) variables to a special
value in order to detect use of an uninitialised variable. If this
option isn't used, automatic variables are pseudo-random values that
might have a higher probability of being zero in a debug build.
There's no magic that initialises automatic variables to zero in debug
builds.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
.



Relevant Pages

  • Re: Problem only in release version!
    ... the Debug version initializes most variables ... to zero. ... the contents of the memory addresses they happen to get assigned to). ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Frustrating Lack of support with Sproxy.exe
    ... the Debug version initializes most variables ... to zero. ... the contents of the memory addresses they happen to get assigned to). ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Frustrating Lack of support with Sproxy.exe
    ... > Just to affirm Tomas's point, the Debug version initializes most variables ... > they keep the contents of the memory addresses they happen to get assigned ... > fine if initialized to zero, but don't work if not initialized to zero (or ... > variables) even if it is totally stable in Debug mode. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Problem only in release version!
    ... not executed in Release mode (I believe, but I also thought Debug ... initialized variables to zero, ... The Release version will not initialize anything 'naturally' ... >>the contents of the memory addresses they happen to get assigned to). ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Problem only in release version!
    ... The debug version doesn't initialize anything to zero that isn't ... the debug heap manager sets memory to certain non-zero values ...
    (microsoft.public.dotnet.languages.vc)