PC Lint 并检查可能的 nullptr

PC Lint and check for possible nullptr

我的 PC Lint V9.00k 在一个非常简单的情况下是无声的,而我本以为会收到警告,即使是在 -w3 上也是如此。 有谁知道是否有一些设置让 Lint 检查这种情况?

int* fp() { return 0; }
void f()
{
      int* p = fp();
      *p = 2; // I would expect something like "Issue 613: (Warning -- Possible use of null pointer..." here
}

对于价值跟踪,PC-lint 需要多次处理代码。 IE。您至少需要在配置中使用 -passes(2)。