In an interface such as this:
@interface MyClass : NSObject
{
bool PlainOldBool;
}
@end
… does PlainOldBool get auto-initialized to false, or is it necessary to use an init method to do that explicitly?
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.
Yes (unless your
falseis not 0). The default+alloc/+allocWithZone:method will automatically zero out all ivars.From https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#//apple_ref/doc/uid/TP40002974-CH4-SW17