Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!swrinde!emory!hubcap!grimlok From: grimlok@hubcap.clemson.edu (Mike Percy) Newsgroups: comp.lang.c Subject: Re: Compressing C programs Message-ID: <7600@hubcap.clemson.edu> Date: 8 Jan 90 18:30:10 GMT References: <1990Jan7.161841.6470@druid.uucp> Organization: Clemson University, Clemson, SC Lines: 38 From article <1990Jan7.161841.6470@druid.uucp>, by darcy@druid.uucp (D'Arcy J.M. Cain): > In article <18731@netnews.upenn.edu> ferris@eniac.seas.upenn.edu.UUCP (Richard T. Ferris) writes: >>I am interested in learning how to reduce the size of my TurboC >>programs. The .exe files are 13K even for very simple programs. >>Could someone send me some suggested references? Thanks. >> > > I have the following flags (among others that don't have to do with code > optimization) in my TURBOC.CFG file: > > -v- Source level debugging off > -Z Optimize register usage > -r register variables > If you can avoid using printf, do so. Printf drags in a large routine. Many times you can use puts rather than printf. In my experience, puts is not only smaller than printf, but faster. Another thing in TurboC to avoid if possible is dragging in the floating point libraries when you don't need them. If you have no floats or doubles, you don't have to include the floating point emulator. If you do have floats, and don't have an 80x87, you are stuck with the emulator. Turn off floating point with -f-. Be careful when using the -Z flag, as it can cause _very_ difficult-to-track-down bugs. You might also try -O (optimize for size). Make sure that you haven't set -v and -y. The keep executables small, use -v- and -y-. -- 'I just couldn't convince the voters that Dukakis was Greek for "Bubba".' -- Lloyd Benson explaining why the Democrats didn't carry Texas