title: Performance: better to inizialize variable or just fill it?
body: <p>Let's say i have a function that is called 10 times a second, something like:</p>
  
  <pre><code>void RxData(System::Byte *Data){}
  </code></pre>
  
  <p>in this function i want to fill a struct with *Data, where the struct is like:</p>
  
  <pre><code>Struct datastr{
  float first;
  float second;
  }
  </code></pre>
  
  <p>in term of performances and memory use is better to declare a extern variable <code>datastr str1</code> and then doing:</p>
  
  <pre><code>void RxData(System::Byte *Data){str1=*reinterpret_cast&lt;datastr*&gt;(Data);}
  </code></pre>
  
  <p>or reinizializing every time the struct, like:</p>
  
  <pre><code>void RxData(System::Byte *Data){datastr str1; str1=*reinterpret_cast&lt;datastr*&gt;(Data);}
  </code></pre>
  
  <p>can someone explain what are the differencies in term of memory management? i tend to think that the second option is more "clean" but i cannot realy argue why.</p>