Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think you're making an assumption that's probably false: that the crash happens after having <strong>successfully</strong> checked <code>myIt != m_myMap.end() &amp;&amp; myIt-&gt;second.userStatus</code> in the same iteration. I'd bet that the crash immediately follows the first time these values are examined. It's the optimizer that makes it look like you've cleared the first two <code>if</code> conditions.</p> <p>Try putting a completely different code block into the loop and see if it crashes there (my bet is that it would -- I don't think you'll see the output from <code>cerr</code> immediately preceding a crash.)</p> <pre><code>// New code block MyMapIterator yourIt = m_myMap.find(otherID); if (yourIt != m_myMap.end() &amp;&amp; yourIt-&gt;second.userStatus == STATUS_A || yourIt-&gt;second.userStatus == STATUS_B) { cerr &lt;&lt; "Hey, I can print something! " &lt;&lt; std::ios::hex &lt;&lt; this &lt;&lt; endl; } // Original code MyMapIterator myIt = m_myMap.find(otherID); if (myIt != m_myMap.end() &amp;&amp; myIt-&gt;second.userStatus == STATUS_A) { //Prints stuff. No side-effects whatsoever. } else if (myIt != m_myMap.end() &amp;&amp; myIt-&gt;second.userStatus == STATUS_B &amp;&amp; myIt-&gt;second-&gt;foo == FOO_A) { //Prints stuff. No side-effects whatsoever. } else if (myIt != m_myMap.end() &amp;&amp; myIt-&gt;second.userStatus == STATUS_B &amp;&amp; myIt-&gt;second-&gt;foo == FOO_B &amp;&amp; /*other meaningless conditions */) { //Prints stuff. No side-effects whatsoever. } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload