title: Allocation of memory ( C++ ) Compile-time/Run-time?
body: <p>I am not sure how appropriate is this question, but -</p>
  
  <p><em>I am curious about how the compiler sets memory aside for an object (allocation of memory) even before it is constructed (before even the constructor is called!)</em>.</p>
  
  <p><em>How does it happen for primitive datatypes?</em></p>
  
  <p>This sounds a bit naive, but what exactly is it ?</p>
  
  <p>Is it entirely a run time process, or does it (the compiler) have any plans like <em>to do this</em>, <em>to do that</em>, during run-time, which it decides before hand during the <em>compile- time</em>. I have no idea at all!</p>
  
  <blockquote>
    <p>An object, be it a primitive type, a pointer, or a instance of a big class, occupies a certain known amount of memory. That memory must somehow be set aside for the object. In some circumstances, that set-aside memory is initialized. That initialization is what constructors do. They do not set aside (or allocate) the memory needed to store the object. That step is performed before the constructor is called.</p>
  </blockquote>
  
  <p>In other words, when does the memory allocation for literally ANY kind of variable happen, in terms of time, at which point? At which step in compilation (or run-time)?</p>