|C++ vs C compiler on size firstname.lastname@example.org (1997-01-07)|
|Re: C++ vs C compiler on size email@example.com (Arch Robison) (1997-01-09)|
|Re: C++ vs C compiler on size firstname.lastname@example.org.OZ.AU (1997-01-12)|
|Re: C++ vs C compiler on size email@example.com (1997-01-12)|
|Re: C++ vs C compiler on size firstname.lastname@example.org (1997-01-12)|
|Re: C++ vs C compiler on size email@example.com (Stanley Chow) (1997-01-14)|
|Re: C++ vs C compiler on size firstname.lastname@example.org (Joseph Donahue) (1997-01-14)|
|Re: C++ vs C compiler on size email@example.com (1997-01-16)|
|Re: C++ vs C compiler on size firstname.lastname@example.org (Kurt Svensson) (1997-01-16)|
|From:||email@example.com (Bill Leonard)|
|Date:||12 Jan 1997 11:35:02 -0500|
|Organization:||Harris Computer Systems, Ft. Lauderdale FL|
|Keywords:||C, C++, code|
firstname.lastname@example.org (Zhenghao Yeh) writes:
> On average, how much bigger the code generated by C++ compiler than
> C compiler? Well, you may answer that this depends which compiler is
> used and what C++ features are used. Assume we have C code, we use
> both C++ and C compiler. Is the size of the generated code supposed
> to be same?
To make the question meaningful, I think you have add the condition
that the given code is both legal C and legal C++, and has the same
meaning in both languages.
Given that, and given that many C++ compilers can also compile in a
C-only mode, I would expect to get the same object code in both
languages. The size of the executables might be different, however,
due to differences in symbol processing (e.g., name mangling for C++)
for the two languages.
However, if you are comparing two different compilers, I would have no
expectations when comparing the size (or contents) of the object code.
In fact, I wouldn't have any expectations when comparing two different
> How much overhead we have to pay if we need:
> 1. inheritance?
> 2. virtual functions?
> 3. template?
I don't think anyone can answer that definitively -- it depends too
much on the compiler, the machine architecture, and exactly how those
features are being used.
But more importantly, be careful of what you are comparing to. It
seems ridiculous to me to compare a virtual function call to a
non-virtual function call, because they are used for different
purposes! I wouldn't compare those two any more than I would compare
an addition to a division operation.
If you are comparing C++ to C, then you should compare two equivalent
things. For instance, compare a virtual function call to the
*equivalent* C code that would implement the same functionality.
Concurrent Computer Corporation
2101 W. Cypress Creek Road
Fort Lauderdale, FL 33309
Return to the
Search the comp.compilers archives again.