warning: iteration 2u invokes undefined behavior [-Waggressive-loop-optimizations]



  • Here is a piece of code:

    QDataStream &operator<<(QDataStream &out, const sq_settings_t &t)
    {

    for (int i=0; i<4;i++)
    {
        out << (quint8)t.io_type[i]
            << t.pd_100k[i]
            << t.probe_diff[i]
            << t.pull_ena[i]
            << t.pull_val[i];
    }
    
    out << t.adr_cap_lim
        << t.adr_gen_lim
        << t.max_trig_steps
        << t.post_trig_len
        << t.s_clk
        << t.t_clk
        << t.thresh
        << t.tvcc;
    
    return out;
    

    }

    The problem is, the line "<< t.probe_diff[i]" generates a warning, that i don't understand at all.

    Can someone explain to me what is this warning, or at least how to remove it?

    ps: i know it's warning and it's not an error, but still, i am cleaning up my code and getting rid of all warnings.


Log in to reply
 

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