title: history of memcpy and memset vs assignment and initialization
body: <p>So, my understanding is that the following code:</p>
  
  <pre><code>somestruct_t a = {0};
  somestruct_t b;
  b = a;
  </code></pre>
  
  <p>is always preferable, when possible, to:</p>
  
  <pre><code>somestruct_t a;
  somestruct_t b;
  memset(&amp;a, 0, sizeof(a));
  memcpy(&amp;b, &amp;a, sizeof(a));
  </code></pre>
  
  <p>And the top constructs are almost always possible...which leads me to my question:  Since the top code both performs well, and is to me <em>clearly</em> more intuitive to someone learning the language, why are the <code>memset</code> and <code>memcpy</code> patterns so amazingly prevalent in C and even non-OO C++ code?  Literally every project I've worked on for decades prefers the bottom pattern.</p>
  
  <p>I'm assuming there is some historical reason for it, such as very old compilers not supporting it or somesuch, but I'd very much like to know the specific reason.  </p>
  
  <p>I know <em>general</em> history questions are off-topic, but this is about a <strong>very specific</strong> bad practice that I would like to understand better.</p>
  
  <p><strong>EDIT</strong> I am NOT trying to assert that memcpy and memset are bad in general.  I'm talking about a very specific use pattern of assignment or initialization of a single structure.</p>