J.C. Pizarro wrote:
There is some strange in the generated program.
For large projects with uninitialized variables, the behaviour
could be stochasticly flawed as a russian roulette.
Can I just end this with "undefined behaviour is not defined?"
If you want to know what is actually going on, fire up gdb, and
single-step asm operations. Most likely "3" is some counter in the
optimized case, (just happens to be) and not in the others. Who cares,
it's undefined.
And stop using "stochastically random" too ... that's annoying. It's
called "garbage" (not to be confused with MSFT software ...).
:-)
Tom