title: A "--" operator in while loop function
body: <p>I am coding in C on a IAR compiler and have two while loops:</p>
  
  <pre><code>i= 5;
  do {
      Task_sleep(1000);
  }while(i-- &amp;&amp; !Ready);
  
  if (!Ready)
     {
        dprint("No ready response!");
        return false;
     }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>i= 5;
  do {
  
      Task_sleep(1000);
      i--;
  }while(i &gt; 0 &amp;&amp; !Ready);
  
  if (!Ready)
         {
            dprint("No ready response!");
            return false;
         }
  </code></pre>
  
  <p>The first will skip over the while loop and the second works properly.  The "Ready" bool is set in another thread.  The first loop will return false and the second will pass so Ready is not getting set to true.</p>
  
  <p>I am thinking the compiler does not know how to handle the i-- in the while and is setting it to false.  Is there something else that could be going on?  With my setup I cannot step through the code in debug.</p>
  
  <p>Edit Added to functions:</p>
  
  <pre><code>if(!Ready)
  {
   dprint("No Ready responce!");
  return false;
  }
  </code></pre>
  
  <p>Tested Ready as volatile, --i instead of i--, and removing Ready.  All failed.  Testing:</p>
  
  <pre><code>}while(((i--) &gt; 0) &amp;&amp; !Ready);
  </code></pre>
  
  <p>Still fails, it has to be the IAR compiler not reading the i-- properly and needs to have the -- operation removed from the while function.  Let me know if you guys have anything else I can try but I feel confident in closing this issue.</p>