开发者

Catching cases of missing self when setting ivars

Does anyone know of a decent way to catch forget开发者_Python百科ting to use 'self.' when setting variables? Is there an xcode compiler setting that can trigger warnings? I'm trying to think of the easiest way to make ensuring there is a 'self.' in front of assignments foolproof.


The best I can suggest so far is to differentiate the ivar and property name, like:

@implementation Person
@synthesize firstName = firstName_;
@end

so it is harder to make mistake, though it is not foolproof.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜