Objective-C中的单个下划线显然是为Apple的“内部”使用保留的(并且可以在Apple声明之前与私有实例变量一起使用)。但为什么他们会在iPhone的SQLiteBooks示例中使用double -underscore?看到这个片段来自MasterViewController.m采取:Cocoa中的这种双下划线是什么
+ (EditingViewController *)editingViewController {
// Instantiate the editing view controller if necessary.
if (__editingViewController == nil) {
__editingViewController = [[EditingViewController alloc] initWithNibName:@"EditingView" bundle:nil];
}
return __editingViewController;
}
有这个forum的双下划线使用提,因为它涉及到C - 这是对“compier内部使用。”我想我没有看到在这种情况下如何适用。
我需要一个ViewController在我的应用程序中表现得非常像SQLiteBooks示例项目中的一个,但是这种双下划线让我感到困惑。
那么你是说现在Apple已经声称它已经被内部使用,现在它已经被替换掉了一个下划线? – Meltemi 2009-02-19 18:46:02
这忽略了问题的实际问题。 – 2009-02-19 18:46:33
是的,它和Apple的单下划线一样。 (不,安德鲁,我不相信自己错过了这一点,他问他们为什么使用双下划线,我解释过。) – Chuck 2009-02-19 18:52:53