@Aardvajk: initialising to 0 is predictable, consistent and testable. It will also screw up equations in a consistent way that is easily detectable with a debugger. Random values arent and can do all sorts of insidious things like cause integers to inoccuously roll over and just generally spoil the party. At least, that's my interpretation of the situation.
It would be feasible I guess for a compiler to initialise a local POD variable to zero in debug build if this was desired. Behaviour desired for debugging should be removable by switching build types, not by modifying code.
[quote name='Aardvajk' timestamp='1308643129' post='4825873']
I'm going to go out on a limb here and argue that for, say, an int, there is no such thing as an insane value. 0 is no more a default value than 325434 or -26. On this basis, I don't see any advantage to initialising an int to 0 unless that happens to be the value I intend it to hold for other reasons.
@Aardvajk: initialising to 0 is predictable, consistent and testable. It will also screw up equations in a consistent way that is easily detectable with a debugger. Random values arent and can do all sorts of insidious things like cause integers to inoccuously roll over and just generally spoil the party. At least, that's my interpretation of the situation.
0 also IS the default value for POD types. :-p
[/quote]
Only for globals and statics where there is no overhead in having such an initialisation. There is no such thing as a "default" value for a stack-based POD.