Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. warning: iteration 2u invokes undefined behavior [-Waggressive-loop-optimizations]
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blackrabbit
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved