静态分析器错误地发现表达式“始终为 0”
我有一个属性 noteName,声明如下:
@property (nonatomic,assign) IVNoteName noteName;
并定义如下:
@synthesize noteName;
但是当我尝试使用它时,静态分析器的行为很奇怪。
NSInteger noteNameOffsets[8] = {0,2,3,5,7,8,10};
midiValue += noteNameOffsets[[self noteName]]; //On this line,
//the analyzer tells me "The right operand to '+=' is always 0"
我已在该方法调用中记录了 [self noteName]
的值,发现了许多合理的非零值。此外,该代码的方法按预期工作。
I have a property, noteName, declared as follows:
@property (nonatomic,assign) IVNoteName noteName;
and defined as follows:
@synthesize noteName;
but when I attempt to use it, the static analyzer behaves strangely.
NSInteger noteNameOffsets[8] = {0,2,3,5,7,8,10};
midiValue += noteNameOffsets[[self noteName]]; //On this line,
//the analyzer tells me "The right operand to '+=' is always 0"
I have logged the value of [self noteName]
in that method call, finding many sensible, non-zero values. Furthermore, the method this code is from works as intended.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Xcode 4.2 中这不再是问题。
This is no longer an issue in Xcode 4.2.