Path: utzoo!attcan!telly!nebulus!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Newsgroups: comp.lang.c Subject: Re: Compressing C programs Message-ID: <1990Jan7.161841.6470@druid.uucp> Date: 7 Jan 90 16:18:41 GMT References: <18731@netnews.upenn.edu> Reply-To: darcy@druid.UUCP (D'Arcy J.M. Cain) Organization: D'Arcy Cain Consulting, West Hill, Ontario Lines: 44 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 I'm not sure what you mean by very simple but here are two test programs: PROGRAM 1: (Include standard I/O) #include main() { printf("Hello, world\n"); } PROGRAM 2: (Ultra minimal) main() { int x = 1; } The executables come out to 6544 for (1) and 2310 for (2). This tells us what we knew all along, that code size is often affected by what is pulled in by the standard libraries, especially standard I/O. You might also try the above flags (especially -v-) to save a few bytes. Note that this assumes that you are compiling with TCC, not the environment. I usually develop code in the environment and the delete all the objects and re-compile with TCC. You can do similiar things in the programming environment. -- D'Arcy J.M. Cain (darcy@druid) | Thank goodness we don't get all D'Arcy Cain Consulting | the government we pay for. West Hill, Ontario, Canada | No disclaimers. I agree with me |