Re: C++ vs C executable file size

From: Alwyn (dt015a1979_at_mac.com.invalid)
Date: 10/03/04


Date: Sun, 03 Oct 2004 22:38:58 +0100

In article <41606c96$0$15748$7a628cd7@news.club-internet.fr>, Alain
Cabiran <alain@yoko.priv> wrote:
>
> You compare different code ... have you tried compiling the same code
> with both gcc and g++ ? Here, the dynamic g++ size is 300 bytes larger
> but static ones are the same. (about 430Kb with gcc/g++ 3.0 on ia32)
>
> the difference between sizes in your example is a little bit ...
> "triché" (cheated) :-)

Mais oui, je parle français, moi aussi!

> One uses stl but not the other.

One uses the C standard library and the other the C++ standard library
to produce the same result. How can you call that *triché*?

Anyway, GCC is capable of taking the same C code and producing in C++
mode what seems to be exactly the same object:

~ $ cp hello.c hello3.cc
~ $ cat hello3.cc
#include <stdio.h>

int main(void)
{
  puts("Hello world!");
}
~ $ c++ -o hello3 hello3.cc
~ $ ./hello3
Hello world!
~ $ ls -l hello3
-rwxr-xr-x 1 alwyn alwyn 11548 3 Oct 22:36 hello3
~ $

Alwyn



Relevant Pages

  • Re: C++ vs C executable file size
    ... >> You compare different code ... ... have you tried compiling the same code ... >> the difference between sizes in your example is a little bit ... ... vehicle, ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Borland Delphi + 64Bits
    ... what is the size of integer when compiling for 64 bit ... have all sort of processor sizes 32 bit, 16 bit, 8 bit etc. ... Currently Delphi has int64 as a defined type. ... integer as compared to straight load and use of 64 bit integer? ...
    (borland.public.delphi.non-technical)
  • Re: Distinct linear orderings on Z
    ... > product of the set domain and the set density. ... Can we or can we not compare sizes of arbitrary sets or do you believe ... To avoid wasting his time with unlucky ...
    (sci.math)
  • Re: panic: vfs_getopt: caller passed opts as NULL
    ... Kris Kennaway wrote: ... It's just that compiling in the extra debugging (it might be ... DEBUG_LOCKS or DEBUG_VFS_LOCKS, I forget which), causes the sizes of ...
    (freebsd-stable)
  • Re: Ultimate debunking of Cantors Theory
    ... relative sizes? ... And I can declare that every initial segment of the diagonal of the ...
    (sci.math)