Re: How do I delete a folder through code?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"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




.



Relevant Pages

  • what timer?
    ... "add eax, 45 ... xor eax, 89933 ... sub ecx, 45 ... Tempo Parziale=14 ...
    (alt.lang.asm)
  • Re: Any explanations
    ... the compiler expects there would be done something useful ... movl %esp, %ebp ... xorl %eax, %eax ...
    (comp.lang.asm.x86)
  • Re: SuperFastHash revisited
    ... mov edi, eax // remainer ... ecx // Start value for hash ... xor eax, ecx ... mov ecx, eax ...
    (borland.public.delphi.language.basm)
  • Re: Any known fast hash algorithms ?
    ... test eax, eax // data ... movzx ecx, word ptr ... xor eax, ecx ... mov ecx, eax ...
    (borland.public.delphi.language.basm)
  • Re: uses of xor
    ... Clear word, complement word, flip bits - any bits flipped? ... sub edx, eax ... xor eax, edx ...
    (comp.lang.asm.x86)