Instance variable access from functions
Instance variable access from functions
- Subject: Instance variable access from functions
- From: Seth Willits <email@hidden>
- Date: Tue, 21 Apr 2009 19:40:05 -0700
Is the non-protected access of instance variables from functions
defined inside of @implementations documented anywhere? I'm wondering
if this some secret thing that I shouldn't use, or something that's
actually pretty common used?
@interface Foo : NSObject
{
int special;
}
- (void)print;
@end
@implementation Foo
static inline void dotheprint(Foo * self)
{
NSLog(@"%d", self->special); // If defined outside @imp it'd give a
compiler error
}
- (id)init;
{
[super init];
special = 5;
return self;
}
- (void)print;
{
dotheprint(self);
}
@end
--
Seth Willits
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden