title: Initializing variables in an "if" statement
body: <p>I read that in C++17 we can initialize variables in <code>if</code> statements like this</p>
  
  <pre><code>if (int length = 2; length == 2)
      //execute something
  </code></pre>
  
  <p><strong>Instead of</strong></p>
  
  <pre><code>int length = 2;
  if (length == 2)
      //do something
  </code></pre>
  
  <p>Even though it is shorter, it affects the code readability (especially for people who don't know this new feature), which I suppose is a bad coding practice for large software development.</p>
  
  <p>Is there any advantage of using this feature other than making the code shorter?</p>