🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #2186

Re: Code size generated by Turbo C

#2186
From: Joel Spolsky
Date: Wed, 19 Sep 1990 18:42
27 lines
1855 bytes
In article <139400009@uxa.cso.uiuc.edu> klg0582@uxa.cso.uiuc.edu writes:
>One thing I don't like for Turbo C is that the
>executable code for the program of same purpose is larger in C than in
>pascal. Is this generally true or is there a way to avoid this?

This may be true for trivially small programs but the difference
is probably insignificant for large programs.

One way to reduce the size of Turbo C programs is to use Pascal
calling conventions instead of C. That helps a bit. Also avoid big
general purpose functions like [c]printf if fputs and itoa will do the
job.

>Also, if I added in an irrelevent function to a program (the other
>function won't have any link to this added-in function at all), the
>code becomes larger accordingly. Could anyone tell me why?

I'm not sure if I understand your question, but the answer is probably
that the Turbo linker is not very bright; it goes for speed over
brains. If you have a module with 2 functions in it and only reference
one, the entire module is linked in. An argument for splitting up your
libraries / OBJ files as much as possible. If you are really hurting
for space get the latest version of Turbo C and use VROOM, or buy an
expensive linker.

Joel Spolsky
spolsky@cs.yale.edu                                     Silence = Death
Technical Details
Message-ID: <26252@cs.yale.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!bu.edu!rpi!uwm.edu!cs.utexas.edu!yale!quasi-eli!cs.yale.edu!spolsky-joel
References: <139400009@uxa.cso.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!bu.edu!rpi!uwm.edu!cs.utexas.edu!yale!quasi-eli!cs.yale.edu!spolsky-joel
From: spolsky-joel@cs.yale.edu (Joel Spolsky)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Code size generated by Turbo C
Message-ID: <26252@cs.yale.edu>
Date: 19 Sep 90 18:42:17 GMT
References: <139400009@uxa.cso.uiuc.edu>
Sender: news@cs.yale.edu
Organization: Yale University Computer Science Dept., New Haven, CT 06520-2158
Lines: 27
Nntp-Posting-Host: zoo-gw.cs.yale.edu
Originator: spolsky@suned.CS.Yale.Edu