I know that the compiler will sometimes initialize memory with certain patterns such as
0xDD. What I want to know is when and why this happens.
Is this specific to the compiler used?
free/delete work in the same way with regard to this?
Is it platform specific?
Will it occur on other operating systems, such as
My understanding is this only occurs in
Win32 debug configuration, and it is used to detect memory overruns and to help the compiler catch exceptions.
Can you give any practical examples as to how this initialization is useful?
I remember reading something (maybe in Code Complete 2) saying that it is good to initialize memory to a known pattern when allocating it, and certain patterns will trigger interrupts in
Win32 which will result in exceptions showing in the debugger.
How portable is this?