title: Placement new and alignment in C++
body: <p>Consider the following code snippet constructing an instance of a POD (plain old data) struct in-place:</p>
  
  <pre><code>#include &lt;new&gt;
  #include &lt;cassert&gt;
  #include &lt;cstddef&gt;
  
  struct Test
  {
      int a;
      char b;
      double c;
  };
  
  int main()
  {
      const std::size_t minimumNumberOfBytes = sizeof( Test ) * 4;
  
      // Get a block of memory that can accommodate a Test instance and then some!
      void* const ptrToMemBlock = new char[ minimumNumberOfBytes ];
      assert( ptrToMemBlock );
  
      // Construct a Test instance in-place.
      const Test* const testInstance( ::new ( ptrToMemBlock ) Test() );
  
      // Is this assumption guaranteed to be true?
      assert( testInstance == ptrToMemBlock );
  }
  </code></pre>
  
  <p>Is the assumption represented by the final assert() <strong>guaranteed</strong> to always be correct? Or is it conceivable that the compiler might decide to construct the Test instance, say a few bytes after the start of the memory block I specified in the placement-new call?</p>
  
  <p>Note that I'm asking specifically about POD types here. I know that things can get iffy if multiple inheritance and stuff like that gets involved.</p>