On Feb 24, 2012, at 7:50 AM, Oleg Krupnov wrote: > An interesting question. The following samples are equivalent in terms > of compiled code, but which one is more correct from the language's > point of view? > > self = [super init]; > if (self) > { > } > return self; > > self = [super init]; > if (self != nil) > { > } > return self;
It may really boil down to a stylistic issue, but I believe that the "self != nil" syntax is the most canonical. > I also heard that generally speaking NULL is not necessarily always > equal to 0 on all architectures. I don't believe this is the case. There can be funny issues with BOOL types, such that BOOL == YES is an inadvisable construct, since your BOOL could be an integer of any value. HTH, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business" _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com