EXE file size: managed C++ vs C#

  • Thread starter Thread starter Vitaly Zayko
  • Start date Start date
V

Vitaly Zayko

I created two absolutely identical projects (one form, two buttons rise
two MessageBoxes) - one in managed C++ and second in C# (bough are .NET
1.1). Size of executable files I got were 76K-release/136K-debug in C++
and 20K/20K in C#. I didn't expect absolutely same size. Just wondering
why C++ exe more than three times bigger than C#?
Thanks!
 
Vitaly,

I saw that VBNet can have even smaller exe's.

I assume that what every team build around it is the reason for it.

A simple test is of course to create in all Net four languages a form
application withouth any code and than to see what is in the exe.

(My expirience about C# and VBNet showed that the differences are not
stable. I saw it in the way I showed it above).

Cor
 
Hi,

What amount of code your c++ project is?

How many lines the source code has?

I would compare c# more to VB.NET than to C++ , ( I may be flamed for this
comment in this NG :) )

cheers,
 
It's just one form with two buttons on it. Each button opens MessageBox
with 18 bytes text and 4 bytes title. Anything else is default.
C++ has 100 lines includes default comments (Form1.h)
C# has 111 lines (Form1.cs)
I didn't use VB for last 10 years. But I know C++ and learning C#. I'm
still in dark which one to take as primary. That's why I make tests
time to time.
 
Hi,

In these times of 500 GB a HDD what is 100Kb ?

IMO you better concentrate in other metrics:
1- Knowledge of the languages
2- Market requests
3- Personal expectations
4- Consult a fortuneteller :) or maybe a luck cookie :)

cheers,
 
That's probably because I do pure C for embedded past two years :)
Seriously: I'm trying to understand which language is better for which
purpose. That was just one test from several others. I wrote this thread
because results I got are so unexpected for me. I agree: size is no
longer matter :))
 
Because the ME C++ version has C runtime code linked in, this is going away
when you are using C++/CLI in safe mode. Note that the MEC++ version cannot
generate verifiable code.


Willy.
 
Back
Top