There is no default value if you write
-(void)somemethod {
BOOL x; // <--- no default value
It is initialized to garbage.
However, for a BOOL
ivar, it will be initialized to NO
, as the whole instance is filled with 0 on initialization.
(Note: When ARC is enabled, local object pointers will always be have a default value nil
, but local variables of non-object types like BOOL are still initialized to garbage. See Local variables set to nil? (Objective-C).)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…