VC++ 6 or ASM optimizations
This is just something I came across and I was wondering if someone could tell me why this happens :
I created a C program in VC++ 6 which just displays a plain window.I used the WIN32 Api,no MFC or anything else.I defined
#define WIN32_LEAN_AND_MEAN
and included windows.h.
In WinMain,I initialize the WndClass structure,register the class and create the window using CreateWindow.
Then the message handling loop and i return.
Just a plain generic WIN32 application.Now,I build the exe,optimizing it for size.The file created is of 36 kb.
Next,when i wrote the same program in ASM(using MASM 6),I got an exe of size 5.5 kb(6 times less!).The only diff is that in the ASM prog i used CreateWindowEx as (apparently)MASM 6 has no declaraton for CreateWindow in its headers.
I have heard that VC++6 is the best optimizing compiler for the Win32 platform and had expected the two filesizes to be the same.Could anyone explain why they are so different?
Thanks!
windows.h is pretty big to tell you the truth... and you can''t compare ASM programs to C/C++ programs in any way. ASM will always be smaller and faster since it''s the native tongue language of the computer, and is considered low-leve, whereas C++ is a high-level language. Including libraries in your programs, will make your program larger in size as the number of included files increases.
-------------------------------------------
That's just my 200 bucks' worth!
..-=gLaDiAtOr=-..
-------------------------------------------
That's just my 200 bucks' worth!
..-=gLaDiAtOr=-..
changing the linking option from static to dynamically should shave a ton off the file size
in other words go to
project
settings
C/C++
category: code generation
use run-time library: multithreaded dll
Edited by - Theses on July 19, 2000 2:22:34 PM
in other words go to
project
settings
C/C++
category: code generation
use run-time library: multithreaded dll
Edited by - Theses on July 19, 2000 2:22:34 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement