title: Loop "while" is not satisfying both conditions with interrupt
body: <p>I'm waiting some time for a real-world event (e.g. push a button for 3 seconds) on an AVR or STM32 MCU, and I have trouble with code like:</p>
  
  <pre><code>#define PRESS_BUTTON
  int waiting = 0;
  int t_ms = 0; // time counter
  //...
  
  int main(void)
  {           
      while(1)
      {           
          waiting = t_ms + 3000; // waiting button 3 sec
  
          while ((t_ms &lt; waiting) &amp;&amp; (!PRESS_BUTTON)) // infinite loop
          {}                  
          printf("out"); // not printed
          waiting = t_ms = 0;
      }    
  }
  
  ISR( TIMER0_OVF_vect ) // timer interrupt
  {
      t_ms++;
  }
  </code></pre>
  
  <p>But if I add a <code>printf()</code> inside the <code>while</code> loop, it works!</p>
  
  <p>The same thing happens if I use a <code>do...while</code> loop either. What is causing this?</p>