Re: How do I delete a folder through code?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Fri, 09 May 2008 14:10:07 -0400
One of the advantages of this technique is that you don't need to know what name the
programmer assigned to the first member. In a rational world, there would be one,
corporate-wide, standard for this name, but instead, every programmer got to choose his or
her own name (this is why I often wonder about the lack of any adult supervision of the
programmers). But I don't need to remember what the name is if I use that form of
initialization!
joe
On Fri, 09 May 2008 12:09:27 -0500, "Doug Harrison [MVP]" <dsh@xxxxxxxx> wrote:
On Thu, 8 May 2008 21:31:08 -0700, "Alexander Grigoriev"Joseph M. Newcomer [MVP]
<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.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- 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
- Re: How do I delete a folder through code?
- From: Doug Harrison [MVP]
- Re: How do I delete a folder through code?
- Prev by Date: Re: Using MFC dll from non-MFC application
- Next by Date: Re: 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
|