Just where has this language gone wrong?
Marco Leise
Marco.Leise at gmx.de
Fri Jul 20 07:33:34 PDT 2012
Am Thu, 19 Jul 2012 22:43:17 +0200
schrieb Jacob Carlborg <doob at me.com>:
> On 2012-07-19 16:50, Alex Rønne Petersen wrote:
>
> In C++ it's even better (irony). It depends on what kind of variable is
> declared. I.e. a global variable, a local, instance or a class variable
> (static). Some of these are default initialized, some are not. I have no
> idea which are initialized and which are not.
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!
--
Marco
More information about the Digitalmars-d
mailing list