This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ vs. C asm/object file size


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]