473,795 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why the size of the VC++ produced binary is so huge?

Hi,

I'm newcomer to Microsoft product (VS.net 7.0, C++) and need to understand,
why the binary code obtained using VC++ compiler is so huge as compared to
the code by Borland C++ 5.02 (the same source).

The source code is standard C++, without any extensions, just standard
libraries are statically linked in (/ML for VC++, Single Threaded). The
respective sizes are:
52kb for BC.5.02 and 120kb (!) for VC++ 120kb. Release versions, of course.

Could you make a suggestion how to understand this result? Is it just poor
MS compiler or there are deeper reasons? (I have heard that some programmers
try to hook up other compilers (like gcc) to VS environment). Or, perhaps, it
is my mistake? - what is wrong then? Could you help me with your general
opinion?

Thank you,
Greg
Nov 17 '05 #1
8 1482

"Greg Stoch" <Gr*******@disc ussions.microso ft.com> wrote in message
news:E7******** *************** ***********@mic rosoft.com...
Hi,

I'm newcomer to Microsoft product (VS.net 7.0, C++) and need to
understand,
why the binary code obtained using VC++ compiler is so huge as compared to
the code by Borland C++ 5.02 (the same source).

The source code is standard C++, without any extensions, just standard
libraries are statically linked in (/ML for VC++, Single Threaded). The
respective sizes are:
52kb for BC.5.02 and 120kb (!) for VC++ 120kb. Release versions, of
course.

Could you make a suggestion how to understand this result? Is it just poor
MS compiler or there are deeper reasons? (I have heard that some
programmers
try to hook up other compilers (like gcc) to VS environment). Or, perhaps,
it
is my mistake? - what is wrong then? Could you help me with your general
opinion?


For most cases, my opinion would be: who cares? 52Kb and 120Kb are both 0
size by today's standards. That difference in size will likely remain as an
offset as your program gets larger, not a ratio (i.e. on a 16Mb EXE image,
the VC image might still be 70K bigger, but it won't be 18Mb bigger. It
might even be smaller).

If you really want to see the difference, generate detailed linker maps with
both compilers and identify the corresponding parts. Most likely, the
difference is in the size of the staticly linked standard library, and that
size difference probably mostly equates to differences in standards
conformance.

If you're interested in producing a tiny executable so that people with
glacially slow internet connections can download it, you might want to do a
bit of searching on the 'net for "C Run Tiny", which is a minimal CRT for
VC++.

-cd
Nov 17 '05 #2
Greg,
Could you make a suggestion how to understand this result? Is it just poor MS compiler or there are deeper reasons? (I have heard that some
programmers
try to hook up other compilers (like gcc) to VS environment). Or, perhaps, it
is my mistake? - what is wrong then? Could you help me with your general
opinion?
For most cases, my opinion would be: who cares? 52Kb and 120Kb are both

0 size by today's standards. That difference in size will likely remain as an offset as your program gets larger, not a ratio (i.e. on a 16Mb EXE image,
the VC image might still be 70K bigger, but it won't be 18Mb bigger. It
might even be smaller).


Besides Carl's comments, it might be also possible that section alignment
within the binary image might be an issue. playing with the various linker
switches like /OPT (particularly the old /OPT:Win98) and changing section
alignment (/align) might be valid options if you want to get as small as
possible...
--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #3
Greg Stoch wrote:
I'm newcomer to Microsoft product (VS.net 7.0, C++) and need to understand,
why the binary code obtained using VC++ compiler is so huge as compared to
the code by Borland C++ 5.02 (the same source).

The source code is standard C++, without any extensions, just standard
libraries are statically linked in (/ML for VC++, Single Threaded). The
respective sizes are:
52kb for BC.5.02 and 120kb (!) for VC++ 120kb. Release versions, of course.

Could you make a suggestion how to understand this result? Is it just poor
MS compiler or there are deeper reasons? (I have heard that some programmers
try to hook up other compilers (like gcc) to VS environment). Or, perhaps, it
is my mistake? - what is wrong then? Could you help me with your general
opinion?

Are you using any VC++ optimisation switches? Perhaps you have VC++
standard which provides no optimisation switches?

--
Ioannis Vranos
Nov 17 '05 #4
Greg Stoch <Gr*******@disc ussions.microso ft.com> wrote:
[...]
52kb for BC.5.02 and 120kb (!) for VC++ 120kb. Release versions, of course.
BC 5.02 is a very ancient compiler (it's
almost a decade old) and probably comes
with a rather ancient rtl, too. That by
itself might explain the difference.
[...]
Greg

Schobi

--
Sp******@gmx.de is never read
I'm Schobi at suespammers dot org

"The presence of those seeking the truth is infinitely
to be prefered to those thinking they've found it."
Terry Pratchett
Nov 17 '05 #5
> Are you using any VC++ optimisation switches? Perhaps you have VC++
standard which provides no optimisation switches?

Of course. Good point, I've forgotten to mention that optimizing "for size"
switch increases (!) the size of the output binary by 2kb. :):):):):) . Any
ideas?

Cheers, Greg

"Ioannis Vranos" wrote:
Greg Stoch wrote:
I'm newcomer to Microsoft product (VS.net 7.0, C++) and need to understand,
why the binary code obtained using VC++ compiler is so huge as compared to
the code by Borland C++ 5.02 (the same source).

The source code is standard C++, without any extensions, just standard
libraries are statically linked in (/ML for VC++, Single Threaded). The
respective sizes are:
52kb for BC.5.02 and 120kb (!) for VC++ 120kb. Release versions, of course.

Could you make a suggestion how to understand this result? Is it just poor
MS compiler or there are deeper reasons? (I have heard that some programmers
try to hook up other compilers (like gcc) to VS environment). Or, perhaps, it
is my mistake? - what is wrong then? Could you help me with your general
opinion?

Are you using any VC++ optimisation switches? Perhaps you have VC++
standard which provides no optimisation switches?

--
Ioannis Vranos

Nov 17 '05 #6
> BC 5.02 is a very ancient compiler (it's
almost a decade old) and probably comes
with a rather ancient rtl, too. That by

Sure. But this is rather about standards. When I compile C++ (standard) i
don't see the reason for inreasing the code (the same as for pure C).
Especially for static linking. I agree to "some" extent: also standards
became "larger"; twice seems "too much" though. I would rather expect the
nowadays compilers to produce even smaller code (for standard C++), they are
mature now.

Greg

"Hendrik Schober" wrote:
Greg Stoch <Gr*******@disc ussions.microso ft.com> wrote:
[...]
52kb for BC.5.02 and 120kb (!) for VC++ 120kb. Release versions, of course.


BC 5.02 is a very ancient compiler (it's
almost a decade old) and probably comes
with a rather ancient rtl, too. That by
itself might explain the difference.
[...]
Greg

Schobi

--
Sp******@gmx.de is never read
I'm Schobi at suespammers dot org

"The presence of those seeking the truth is infinitely
to be prefered to those thinking they've found it."
Terry Pratchett

Nov 17 '05 #7
"Carl Daniel [VC++ MVP]" wrote:
For most cases, my opinion would be: who cares? ....
50kb vs. 120kb was the example. Essential is the nature of this "code
increase" (valid for any size) and you actually answered this below, thank
you. If this is the offset only - then allright. If it scales with the
project size - then it is likely something very sad about the compiler.
That difference in size will likely remain as an offset....not ratio...
Exactly. I just hope that it doesn't scale with the size.
If you're interested in producing a tiny executable so that people with

glacially ... searching on the 'net for "C Run Tiny", ...

Thanks, that's thel hint, I'll do it.

Greg
Nov 17 '05 #8
Greg Stoch wrote:
Of course. Good point, I've forgotten to mention that optimizing "for size"
switch increases (!) the size of the output binary by 2kb. :):):):):) . Any
ideas?

Cheers, Greg

Perhaps may you post the code to experiment ourselves? :-)

--
Ioannis Vranos
Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
1893
by: Giovanni Bajo | last post by:
Hello, python24.dll is much bigger than python23.dll. This was discussed already on the newsgroup, see the thread starting here: http://mail.python.org/pipermail/python-list/2004-July/229096.html I don't think I fully understand the reason why additional .pyd modules were built into the .dll. OTOH, this does not help anyone, since: - Normal users don't care about the size of the pythonXX.dll, or the number of
1
956
by: Dirc | last post by:
Does anyone have any tips/hints for reducing the size of the XML produced? I can think of a couple: 1. Use XmlAttributeAttribute to save space 2. Used XmlIgnore for properties that are calculated rather than reference private fields.
2
1746
by: Cliff Cooley | last post by:
Will static libraries generated by VB++ 6 always be usable by VC++ 7 applications ? Many thanks, Cliff
5
2346
by: Hari | last post by:
Guys please help me to solve this strange problem what Iam getting as follows.. Trying to instantiate a global instance of a template class as follows :- when i build this code with debug and run this works fine. but if build in unicode release or release this does't work. IS THERE ANY PROBLEM OF INSTANTIATING TEMPLATE CLASSES
0
1456
by: Severino | last post by:
Hi all, we have developed a .NET component for use inside Windows Forms: this component has been written using VC++.NET (2003) and is working perfectly when inserted inside VC#.NET or VB.NET projects; its generated assembly is inside MyAssembly.dll When used inside a VC++.NET project it appears correctly over forms at design time but when trying to compile the project we get the following error:
0
1329
by: Severino | last post by:
Hi all, we have developed a .NET component for use inside Windows Forms: this component has been written using VC++.NET (2003) and is working perfectly when inserted inside VC#.NET or VB.NET projects; its generated assembly is inside MyAssembly.dll When used inside a VC++.NET project it appears correctly over forms at design time but when trying to compile the project we get the following error:
5
3799
by: AliR | last post by:
Hi Everyone, I have a Visual C++ MFC program, and I am trying to use a webservice written in C#. When I add the webservice to my project using Add Web Reference the sproxy compiler complains about one of the object wanting to extend MarshalByRefObject object, and I get an error SDL1030. I can use the webservice in a C# project just fine but not the C++. Can anyone help me out with this?
6
6311
by: waxinwaxout | last post by:
I'm compiling the same set of c++ sources to both x86 (32 & 64) and to mips32. For x86 I'm using gcc 4.1.2 and for mips I'm using gcc 3.4.6. What I don't understand is why the mips binaries are consistently (and significantly) larger than the x86 binaries. Compiling to x86 without any selected optimization level results in a binary of 961600 bytes while compiling to mips32 with -Os results in a binary of 1414612 bytes. Both binaries...
20
3575
by: Peter Olcott | last post by:
Is there any standard C++ way to determine the size of a file before it is read?
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10438
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.