www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/07/01:44:26

Date: Sun, 7 Apr 1996 09:30:51 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Vladislav Panferov <vkat AT math DOT chalmers DOT se>
Cc: djgpp AT delorie DOT com
Subject: Re: Exe size
In-Reply-To: <31658441.2FFA@math.chalmers.se>
Message-Id: <Pine.SUN.3.91.960407091742.22284P-100000@is>
Mime-Version: 1.0

On Fri, 5 Apr 1996, Vladislav Panferov wrote:

> I did remember either, but still the executable size for "Hello world!" program
> is 32,768 bytes with "stdio.h" and 101,888 bytes with "iostream.h" (compiled with 
> "gcc -o hello.exe -O2 -s hello.c" and "gcc -o hello.exe -O2 -s hello.cpp -liostr" resp.)

These figures are meaningless!  You don't judge any serious compiler and
library by looking at the ``Hello world'' programs!  What you see is the
overhead of the DJGPP startup code, and not much else.  That startup code
has a tremendous amount of functionality, which you only can dream about
with other 32-bit compilers.  For instance, the filename globbing code is
inside (so you can say ``hello foo/.../[a-c]*.[ch]'' and have the program
get the list of all the C files and headers which begin with a, b or c, in
the entire directory tree under `foo').

The DJGPP library has provisions to reduce the above overhead in those
programs that don't need that functionality.  If your program doesn't
accept command-line arguments, and doesn't need to get environment
variables from DJGPP.ENV, you can slash its size by about 20KB by defining
a couple of empty functions; see the C library on-line docs for the
details. 

> Does this mean that it's impossible to get an executable smaller than ~100k when 
> using "iostream"?

IMHO, anybody who writes such programs in C++ (and not in assembly, where
they belong), deserves this.  (And btw, how do other C++ compilers compare
with that figure?)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019