title: C++ assign and check in one line?
body: <p>I have a function my_fun which returns random number.</p>
  <p>How can I do declaration and value check in one line?</p>
  <pre><code>int x;
  </code></pre>
  <ol>
  <li><p><code>if (x= my_fun()&lt;0)</code></p>
  </li>
  <li><p><code>if ((x= my_fun())&lt;0)</code></p>
  </li>
  <li><p><code>if ((x= my_fun()&lt;0)) // this is what my IDE suggests but looks strange since those extra braces don't help at all.</code></p>
  </li>
  </ol>