Am Fri, 20 Jul 2012 16:43:18 +0200
schrieb Jacob Carlborg <d...@me.com>:

> On 2012-07-20 16:33, Marco Leise wrote:
> 
> > I think C++ uses a pragmatic approach: No overhead for explicit 
> > initialization. But everything that goes into the executable and doesn't 
> > have a specific value, will go into the BSS section, where it A) takes up 
> > no space and B) the OS will take care of zero initializing it _anyways_.
> >
> > If it is stored in the .exe, it is 0!
> 
> Is it defined what is placed in the executable?

P.S.: s/section/segment/

Someone else would have to answer that question. I assume anything that is kind 
of static, like globals, class variables, D's .init blocks. It makes sense to 
me, because the compiler can issue static references to that data, instead of 
generating code that creates space for it e.g. on the heap and have the program 
use a pointer to get at it.

-- 
Marco

Reply via email to