On Jul 30, 2013, at 10:42 AM, Scott Ribe <scott_r...@elevated-dev.com> wrote: > On Jul 30, 2013, at 8:35 AM, Andy Lee <ag...@mac.com> wrote: > >> The only effect, as others have explained, is on scope; if you put the >> function inside the @implementation and the function has a reference to an >> instance of MyClass, then it can use myObj->myIvar for direct access to >> instance variables. > > Interesting, did not know that. Not sure I'll ever need it… Plain C is one > thing, plain C but with direct access to instance vars?
I think it's subject to the same criticisms as *any* direct access to ivars, although I agree it feels sketchier when done in plain C for some reason. Which reminds me... instance methods can also directly access the ivars of *other* instances of the same class. - (void)myMethod { MyClass *otherInstance = [[MyClass alloc] init]; NSLog(@"%@", otherInstance->myIvar); } --Andy _______________________________________________ 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