Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 [HELP] C++ for loop

views
     
xenon
post Feb 10 2006, 01:00 PM

On my way
****
Senior Member
502 posts

Joined: Jan 2005
From: Selangor

Can be compiled. But result unpredictable.
A new local variable, before initialization, may be holding the value 0xCCCCCCCC. But depends on the code generated by compiler.
A global variable, before initialization, is most likely to be 0.
xenon
post Feb 10 2006, 04:29 PM

On my way
****
Senior Member
502 posts

Joined: Jan 2005
From: Selangor

When entering a function, there is code to adjust the stack pointer to reserve space for local variables. Uninitialized local variables have values that come from old values from the stack that already have been pop-ed. The values are unpredictable.

When using Microsoft development tools, uninitialized local variables are set to 0xCCCCCCCC.

 

Change to:
| Lo-Fi Version
0.0156sec    0.55    6 queries    GZIP Disabled
Time is now: 24th December 2025 - 05:47 AM