title: Is this undefined behavior in C? (c=x) + (c==y)
body: <p>I have a bit of sample code that is throwing this warning:</p>
  
  <pre><code>main.c: In function ‘getline_’:
  main.c:30:32: warning: operation on ‘c’ may be undefined [-Wsequence-point]
  </code></pre>
  
  <p>In this particular exercise I was to avoid using the <code>||</code> and <code>&amp;&amp;</code> operator, but this doesn't seem like it should produce undefined behavior. The compiler message <em>is</em> just a warning, but I wanted to know for knowings sake. Is this code actually going to produce undefined behavior?</p>
  
  <pre><code> 24 int getline_( char s[], int limit)
   25 {
   26     int i, c;
   27     i=0;
   28     for( i=0; (i&lt;limit-1) + ((c=getchar())!='\n') + (c!=EOF) == 3; i++){
   29            s[i]=c;
   30     }
   31     if( c == '\n' ){
   32         s[i]=c;
   33         i++;
   34     }
   35     s[i]='\0';
   36     return i;
   37 }
  </code></pre>
  
  <p>It seems to work ok in my basic tests.</p>
  
  <p>Edit: Updated title as per comment, thanks pst.</p>