EXE file size, C vs. Pascal

Walter Bright bright at nazgul.UUCP
Tue Nov 13 07:14:13 AEST 1990


In article <16398 at mentor.cc.purdue.edu> nuspljj at mentor.cc.purdue.edu (Joseph J. Nuspl Jr.) writes:
/I am trying to keep the size of the
/executables small and have the speed of execution as fast as possible.
/BTW - I don't have time to code every thing in Assembler.

It is possible to write very tiny executables in C. The trick is to avoid
pulling in unused overhead from the C standard library. The first thing to
do is generate a .MAP file and look at it to see what you are pulling in.
Then, see if large and complex functions can be replaced by small and simple
once. For instance, make sure you are not pulling in floating point code
if you aren't using it. Also, try to replace things like printf("abc") with
puts("abc"), as printf is very big and pulls in a lot.

Purchase the library source for your compiler, and study it to see what
depends on what. I think you'll find it very worthwhile!



More information about the Comp.lang.c mailing list