用于警告的特定标志和指针与零之间的有序比较'

时间:2014-10-24 01:06:27

标签: objective-c clang clang-static-analyzer

这段代码有一个指针int比较,我希望将其作为错误捕获:

NSDecimalNumber *number = [NSDecimalNumber zero];
BOOL test = (number > 0); //should have a warning

我发现的唯一标志就是非常广泛-Wpedantic

error: ordered comparison between pointer and zero ('NSDecimalNumber *' and 'int') is an extension [-Werror,-Wpedantic]
BOOL test = (number > 0);
             ~~~~~~ ^ ~

是否有更具体的警告标志来将此操作捕获为错误/警告?

0 个答案:

没有答案