• 5207阅读
  • 2回复

[提问]QbyteArray 为什么有警告? [复制链接]

上一主题 下一主题
离线djnxqc
 

只看楼主 倒序阅读 楼主  发表于: 2014-12-09

    QByteArray ba;
    ba.resize(3);
    ba[0]=0xcf;
    ba[1]=0xfe;
    ba[2]=0x62;
    if(ba[1]==0xfe)//该行有警告!
        qDebug("=====1");

警告:ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
: candidate 1: bool QByteRef::operator==(char) const


离线realfan

只看该作者 1楼 发表于: 2014-12-10
if(ba[1]==0xfe)改成
if(0xfe == ba[1])试试
离线dbzhang800

只看该作者 2楼 发表于: 2014-12-10
最好是 0xfe 改成 '\xfe'
快速回复
限100 字节
 
上一个 下一个