Maybe my memory has gone completely wacko, but I think I remember that declaring pointers without initializing them made them point to nil. But recently this doesn't seem to be the case. Has it always been this way? Or has it something to do with the compiler settings?
+8
A:
Instance variables of objects are initialized to nil
in alloc
(the whole object is bzeroed).
Edit: Also, global and static storage variables are initialized to zero (6.7.8 10 of the C99 Standard, thanks Derek for pointing that out).
Local stack variables are not initialized automatically. This did not change in known history.
Nikolai Ruhe
2009-10-24 21:44:12
Actually, globals and static variables are always initialized.
Derek Ledbetter
2009-10-24 22:22:35
A:
by the way. I found BOOL local variables ware set to 0 automatically. but int value was set to random value.
xhan
2010-09-27 07:51:19