Home c# What is the difference between Windows Forms Application C++ and C #

What is the difference between Windows Forms Application C++ and C #

Author

Date

Category

What is the difference between Windows Forms Application C++ and C #

Create two identical projects

Visual C++ – CLR – Windows Forms Application

and

Visual C # – Windows – Windows Forms Application

Source file in C++ It turns out 48 kb

in C # only 8 kb

question

Do both projects Microsoft .NET Framework

or project on C++ is like in Delphi without .NET technology

???

And why is the different size of the executable file turned out?
After all, inside identical code


Answer 1, Authority 100%

C++ / CLI uses .NET. And just C++ (Win32, Win, Native and other prefixes / suffixes) – no.

Why size is different – you need to watch the decompiler inside. There will be clear. Take iLDASM (built-in, standard) or free Dotpeek from Jetbrains + Link to Habré . Look inside your projects and compare.

Do both projects Microsoft .NET Framework

yes

And why is the different size of the executable file turned out?

C # is the most native language for .NET. All you need, already inside the framework. If something is not – it’s easier to add to the framework. Not for nothing he is hundreds of megabytes.

C++ / CLI is a crutch. And you have to do “adapters”. (Although they could also be crammed into the framework). All the same, the C++ philosophy is slightly perpendicular to C # and .NET. And Microsoft created a new artificial language, which is not C++ and not C #.

After all, inside identical code

No. It can perform the same thing, but the code is different.


Answer 2, Authority 80%

When compiling C++ / CLI project to assemble the a bunch of service code .
In the case of C #, such a “superfluous” code is quite a bit:

get_default
.ctor
.Cctor
Dispose.
InitializeComponent.
sub_c0.
sub_f0.
get_resourcemanager
Get_culture.
set_culture.
Main.

(both assemblies are compiled from empty WindowsFormsApplication projects)

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions