This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ vs. C asm/object file size
- To: scherrey at proteus-tech dot com
- Subject: Re: C++ vs. C asm/object file size
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 11 Jan 1999 07:30:29 -0200
- Cc: EGCS Development Group <egcs at cygnus dot com>
- References: <3699BEB8.150B15BF@gte.net>
On Jan 11, 1999, Benjamin Scherrey <scherrey@gte.net> wrote:
> Turns out both g++ and gcc product IDENTICAL assembly code and the
> files are the same size! Please explain these results to me.
Are you compiling the same .cc/.cpp file with gcc and g++? Remember
that gcc will deduce the language from the extension of the file, so
it might be running the C++ compiler in both cases, even though you
expected it to compile as C when running gcc. The .c extension, OTOH,
will be interpreted as a C source by gcc and as a C++ source by g++.
If this is not the case, maybe you're not talking about object size,
but executable size. Indeed, g++ automatically links in the C++
standard library, that may increase the size of a program even if you
have a shared libstdc++.
Another option that is worth considering is whether you're generating
exception information in both languages. Their generation is enabled
by default for C++, but I think it's disabled by default for C.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil