EXE file size, C vs. Pascal

Jay A. Konigsberg jak at sactoh0.SAC.CA.US
Mon Nov 12 06:06:21 AEST 1990


In article <16398 at mentor.cc.purdue.edu> nuspljj at mentor.cc.purdue.edu (Joseph J. Nuspl Jr.) writes:
>
>Over the past year, I have written several Unix-like commands -- cat, ls, ...
>in Turbo Pascal 5.5.  I have recently rewritten them in Turbo C++ hoping
>to improve speed and/or reduce file size.  The C compiled programs are
>significanly larger.  Cat in Pascal is ~3k, Turbo C ~17, DeSmet C ~10.
>

I have wondered the same thing. Mainly, why are C exectuables so large.

Given the minimum program (foo.c):

main()
{
}

The sizes are (on a 3B2/400 cc, but other machines/C compliers give
about the same).

	 bytes
         -----
foo.c       11
foo.o      256 
foo       4815

As a program gets larger, the overhead stays about the same. This
implies that Unix/C creates a 4K+ header block. My only guess is that
its for bss and stuff. Would anyone care to explain this and give
references? I have looked at a.out.h(4) and suspect the answer is
there, but am unable to ferret it out.

-- 
-------------------------------------------------------------
Jay @ SAC-UNIX, Sacramento, Ca.   UUCP=...pacbell!sactoh0!jak
If something is worth doing, it's worth doing correctly.
Newsgroups: poster
Subject: Exectuable size of C (was: EXE file size, C vs. Pascal)
Summary: 
Expires: 
References: <16398 at mentor.cc.purdue.edu>
Sender: 
Followup-To: 
Distribution: 
Organization: Sacramento Public Access Unix, Sacramento, Ca.
Keywords: C, Pascal, MsDos

In article <16398 at mentor.cc.purdue.edu> nuspljj at mentor.cc.purdue.edu (Joseph J. Nuspl Jr.) writes:
>
>Over the past year, I have written several Unix-like commands -- cat, ls, ...
>in Turbo Pascal 5.5.  I have recently rewritten them in Turbo C++ hoping
>to improve speed and/or reduce file size.  The C compiled programs are
>significanly larger.  Cat in Pascal is ~3k, Turbo C ~17, DeSmet C ~10.
>

I have wondered the same thing. Mainly, why are C exectuables so large.

Given the minimum program (foo.c):

main()
{
}

The sizes are (on a 3B2/400 cc, but other machines/C compliers give
about the same).

	 bytes
         -----
foo.c       11
foo.o      256 
foo       4815

As a program gets larger, the overhead stays about the same. This
implies that Unix/C creates a 4K+ header block. My only guess is that
its for bss and stuff. Would anyone care to explain this and give
references? I have looked at a.out.h(4) and suspect the answer is
there, but am unable to ferret it out.

-- 
-------------------------------------------------------------
Jay @ SAC-UNIX, Sacramento, Ca.   UUCP=...pacbell!sactoh0!jak
If something is worth doing, it's worth doing correctly.



More information about the Comp.lang.c mailing list