EXE file size, C vs. Pascal

Mark M Lacey lacey at cpsin3.cps.msu.edu
Sun Nov 11 00:23:10 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.
>...
>...
>Comments?

Most likely, it is a combination of the library routines that you are
using, along with the code that is being generated by the compiler (are
you sure you don't have TC outputting code for the debugger?).  Another
piece of overhead is the "startup" routine (__main) which most MS-DOS
compilers link in with your code (I believe UNIX 'cc' does the same, but
I don't recall the name of the file it links in).

I have found that most C compilers have particularly bulky library
routines.  I have used Turbo C (and C++), Lattice C, and Zortech C, and
found that almost every time, Zortech produced a much smaller .EXE (like
1-3 K for a small program like cat).  Turbo C & Lattice C always seemed
to by at LEAST 8-10K in size.

--
Mark M. Lacey
(lacey at cpsin.cps.msu.edu)



More information about the Comp.lang.c mailing list