Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!netnews.upenn.edu!msuinfo!news From: lacey@cpsin3.cps.msu.edu (Mark M Lacey) Newsgroups: comp.lang.c Subject: Re: EXE file size, C vs. Pascal Keywords: C, Pascal, MsDos Message-ID: <1990Nov10.132310.29537@msuinfo.cl.msu.edu> Date: 10 Nov 90 13:23:10 GMT References: <16398@mentor.cc.purdue.edu> Sender: news@msuinfo.cl.msu.edu Reply-To: lacey@cpsin3.cps.msu.edu (Mark M Lacey) Organization: Dept. of Computer Science, Michigan State University Lines: 26 In article <16398@mentor.cc.purdue.edu> nuspljj@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@cpsin.cps.msu.edu)