In the following code, is it safe to use _test and expect it to have a vaue of NO? Or do I need to always explicitly initialize it in - (id)init?
@implementation Test {
BOOL _test;
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is safe to assume that all instance variables will be initialized to 0.
This however is not the case for locally/method scoped variables which, if not manually initialized, will point to junk.
For future reference, as Rob Napier points out, this can be found in the documentation for
+ (id)alloc: