Re: How do I delete a folder through code?
- From: "David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 9 May 2008 09:43:41 -0700
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:n8p824pf88hisdv6dlkbknq02n31oh9odl@xxxxxxxxxx
That would be true for statically-allocated objects, which are then moved
to the
initialized data segment by the compiler. It is not true for local
variables.
Here;s some data I got on the oldest, klunkiest compiler I have available
to me:
Release Compiler Option
36,864 VS6 Project with no data declaration
36,864 VS6 I. Struct on stack
36,864 VS6 II. Struct initialized on stack {0}
36,864 VS6 III. Uninitialized static struct
36,864 VS6 IV. Initialized static struct {0}
299,008 VS6 V. Initialized static struct {1}
Note that it detects a static structure whose only initializers create 0
values and
optimizes that.
joe
*****************************************************************************
* I
*****************************************************************************
; 19 : BIG x;
; 20 : x.count = 0;
; 21 : f(x);
0000a 8d 44 24 00 lea eax, DWORD PTR _x$[esp+262148]
0000e c7 44 24 00 00
00 00 00 mov DWORD PTR _x$[esp+262148], 0
00016 50 push eax
00017 e8 00 00 00 00 call ?f@@YAXAAUBIG@@@Z ; f
; 23 : return 0;
0001c 33 c0 xor eax, eax
; 24 : }
0001e 81 c4 08 00 04
00 add esp, 262152 ; 00040008H
00024 c3 ret 0
*****************************************************************************
* II
*****************************************************************************
; 24 : BIG x = {0};
0000b b9 00 00 01 00 mov ecx, 65536 ; 00010000H
00010 33 c0 xor eax, eax
00012 8d 7c 24 08 lea edi, DWORD PTR _x$[esp+262156]
00016 c7 44 24 04 00
00 00 00 mov DWORD PTR _x$[esp+262152], 0
0001e f3 ab rep stosd
; 25 : f(x);
00020 8d 44 24 04 lea eax, DWORD PTR _x$[esp+262152]
00024 50 push eax
00025 e8 00 00 00 00 call ?f@@YAXAAUBIG@@@Z ; f
0002a 83 c4 04 add esp, 4
; 26 : #endif
; 27 : return 0;
0002d 33 c0 xor eax, eax
0002f 5f pop edi
; 28 : }
00030 81 c4 04 00 04
00 add esp, 262148 ; 00040004H
00036 c3 ret 0
*****************************************************************************
* III
*****************************************************************************
PUBLIC ?x@@3UBIG@@A ; x
_BSS SEGMENT
?x@@3UBIG@@A DB 040004H DUP (?) ; x
_BSS ENDS
; 30 : f(x);
00000 68 00 00 00 00 push OFFSET FLAT:?x@@3UBIG@@A ; x
00005 e8 00 00 00 00 call ?f@@YAXAAUBIG@@@Z ; f
0000a 83 c4 04 add esp, 4
; 32 : return 0;
0000d 33 c0 xor eax, eax
; 33 : }
0000f c3 ret 0
*****************************************************************************
* IV
*****************************************************************************
PUBLIC ?x@@3UBIG@@A ; x
_BSS SEGMENT
?x@@3UBIG@@A DB 040004H DUP (?) ; x
_BSS ENDS
00000 68 00 00 00 00 push OFFSET FLAT:?x@@3UBIG@@A ; x
00005 e8 00 00 00 00 call ?f@@YAXAAUBIG@@@Z ; f
0000a 83 c4 04 add esp, 4
; 31 : #endif
; 32 : return 0;
0000d 33 c0 xor eax, eax
; 33 : }
0000f c3 ret 0
*****************************************************************************
* V
*****************************************************************************
PUBLIC ?x@@3UBIG@@A ; x
_DATA SEGMENT
?x@@3UBIG@@A DD 01H ; x
ORG $+262144
_DATA ENDS
; 50 : f(x);
00000 68 00 00 00 00 push OFFSET FLAT:?x@@3UBIG@@A ; x
00005 e8 00 00 00 00 call ?f@@YAXAAUBIG@@@Z ; f
0000a 83 c4 04 add esp, 4
; 51 : #endif
; 52 : return 0;
0000d 33 c0 xor eax, eax
; 53 : }
0000f c3 ret 0
joe
Thanks Joe and Alexander... it was over 10 years ago when I first noticed
using {0} was bloating my .exe's, which was pre-VC6. I would use {0} mostly
for local variables, so it is good that it does not bloat for these. In
addition, I'm very surprised the compiler special-cases 0 and does not bloat
for that regardless. Very good info... I'll have to start using {0} then!
:-)
BTW, I've never seen usage of {}, which Alf says is the same as {0} in most
cases.
-- David
.
- 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: Joseph M . Newcomer
- How do I delete a folder through code?
- Prev by Date: Re: Vista installations (again)
- Next by Date: Re: CodeGear is sold
- 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
|