奇怪的“强类型不匹配”lint警告,如果结构有构造函数

问题描述 投票:0回答:0

我遇到了一个奇怪的“警告 639:强type mismatch for type 'myip' in binary operation

//file ip4.h
#include <IPAddress.h>   // which have ::ip::IPAddress

typedef ::ip::IPAddress myip;

myip myiptest;   // lint Warning 639 
::ip::IPAddress ip2;  // No lint warnings

IPAddress.h文件包含::ip::IPAddress如下

namespace ip
{
    struct IPAddress
    {
        IPAddress();
            ...
    };
}

我认为这里没有不匹配! PC-lint 手册对此错误的描述:

当一个值加入(即组合)时检查强类型 二元运算符中的另一种类型。

怎么了?

更新: 经过试验,似乎仅当结构具有构造函数时才会发出此警告,我认为这以某种方式解释了当我声明一个对象时它返回类型

::ip::IPAddress
而不是
myip
这里是不匹配。我说得对吗?

c++ lint pc-lint
© www.soinside.com 2019 - 2024. All rights reserved.