开发者

Catching cases of missing self when setting ivars

开发者 https://www.devze.com 2023-01-20 09:27 出处:网络
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 e

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

精彩评论

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