Re: How do I delete a folder through code?
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Fri, 09 May 2008 12:09:27 -0500
On Thu, 8 May 2008 21:31:08 -0700, "Alexander Grigoriev"
<alegr@xxxxxxxxxxxxx> wrote:
Actually, {0} initialization is done by the compiler by emitting memset
equivalent, which is pretty much the same as ZeroMemory produces.
The last time I looked at this, which was a looooooong time ago,
initialized static duration data was stored in the DATA segment, where it
added to the executable size, while uninitialized static data was stored in
the BSS segment, where it took up no space in the executable. Given that
the language specifies that uninitialized static data is set to zero
anyway, SOP is to never explicitly initialize static duration data to zero.
Data stored in the BSS is initialized to zero by a memset equivalent, and
this is also done for local non-static variables, i.e. auto variables, as
you said. I'm unaware I ever used a compiler that would create an image of
the initialization data and copy it to these objects. Thus, there is no
reason not to use {0} on the variables for which it is appropriate, namely,
autos. In Windows programming, it's even more common to see things like:
T x = { sizeof(T) }; // x is auto
This is an idiomatic way to initialize a data structure whose first member
specifies the size, while concomitantly zero-initializing the rest of the
struct, which is done with memset equivalent.
--
Doug Harrison
Visual C++ MVP
.
- Follow-Ups:
- Re: How do I delete a folder through code?
- From: Joseph M . Newcomer
- Re: How do I delete a folder through code?
- From: David Ching
- Re: How do I delete a folder through code?
- References:
- How do I delete a folder through code?
- From: scs0
- Re: How do I delete a folder through code?
- From: scs0
- Re: How do I delete a folder through code?
- From: Alexander Grigoriev
- Re: How do I delete a folder through code?
- From: Alf P. Steinbach
- Re: How do I delete a folder through code?
- From: Alexander Grigoriev
- Re: How do I delete a folder through code?
- From: Giovanni Dicanio
- Re: How do I delete a folder through code?
- From: Alf P. Steinbach
- Re: How do I delete a folder through code?
- From: David Ching
- Re: How do I delete a folder through code?
- From: Alexander Grigoriev
- How do I delete a folder through code?
- Prev by Date: Re: Prevent Dialog from Being Shown in OnShowWindow
- Next by Date: Using MFC dll from non-MFC application
- Previous by thread: Re: How do I delete a folder through code?
- Next by thread: Re: How do I delete a folder through code?
- Index(es):
Relevant Pages
|