This is a style question:
Because Apple reserves the "_" privatization for its keywords, I was thinking of something along the lines of the following:
#import <Cocoa/Cocoa.h>
#define _(name) pvt_##name
@interface SFMeasureViewController : NSViewController {
@private
NSTextField *_(label);
}
@property (retain) IBOutlet NSTextField *label;
@end
@implementation SFMeasureViewController
@synthesize label = _(label);
@end
This is to help force the difference between [self label]
and using label
when it comes to retaining, and disposing of the variable properly. Here, using the term "label" within the code returns an error, forcing the user to distinguish between a call to self.label or _(label).
Now _(label)
contains 2 more characters (shift-characters at that) than _label does. Is there any other good conventions out there? vLabel
? Nothing is as quite as clear as _label
but since its reserved, I don't want to use it.
Thoughts, critiques? This is for a style guideline at work, for primarily C++ work using Objective-C++ when necessary.
Thanks,