On Sun, Jan 18, 2009 at 9:23 PM, Ben Trumbull <trumb...@apple.com>
wrote:
Several work arounds exist. The easiest is to create a static C
member
function (yes, ObjC has member *functions* which most people
overlook).
Well no, it doesn't. ObjC has functions, by virtue of being a superset
of C, but it does not have "member functions". You can write functions
that are logically associated with a class, but this is a human
construct, not one that the compiler knows about.
Not sure what compiler you're using, but mine can tell the difference:
#import <Foundation/Foundation.h>
@interface Foo : NSObject {
@private id a;
}
@end
static id plainCFunction(Foo* f);
static id memberCFunction(Foo* f);
static id plainCFunction(Foo* f) {
return f->a;
}
@implementation Foo
static id memberCFunction(Foo* f) {
return f->a;
}
@end
/tmp/members/members.m: In function 'plainCFunction':
/tmp/members/members.m:12: warning: instance variable 'a' is @private;
this will be a hard error in the future
- Ben
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com