title: Am I testing the Return Value Optimization correctly?
body: <p>Consider:</p>
  
  <pre><code>struct Measures {
      char name[128]; // added in response to comments
      int   age;
      float weight;
  };
  
  Measures foo() {
      Measures res;
      cout &lt;&lt; &amp;res &lt;&lt; endl;
      return res;
  }
  
  int main() {
      Measures m = foo();
      cout &lt;&lt; &amp;m &lt;&lt; endl;
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>The output I get by running this code in Visual Studio is:</p>
  
  <pre><code>004FFA30
  004FFB28
  </code></pre>
  
  <p>Do I conclude correctly from the fact that the two addresses differ that the return value optimization is not performed? If so, why would it not be performed in this case (I found several posts dealing with Visual Studio 2017 (version 15.9.14) not performing the Return Value Optimization, but none of them seems to be about this particular case)?</p>