不正确的编译 warning



  • QHBoxLayout  *lay;
    
    for(uint i=0;  i<16;  i++)
    {
        if(i%4 == 0)
        {
            lay = new QHBoxLayout;
        }
        lay->addWidget(new QLabel("***"));
    }
    

    /home/neeme/vivere/ocean/Mint/FFreqBus.cpp:25: warning: ‘lay’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    lay->addWidget(f_cur_hz[i]);

    请问怎样调整代码,才能令QT不再产生这样的提示呢? 谢谢!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.