Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!agate!darkstar!saturn.ucsc.edu!sidney From: sidney@saturn.ucsc.edu (Sidney Markowitz ) Newsgroups: comp.os.msdos.programmer Subject: Re: Code size generated by Turbo C Message-ID: <7010@darkstar.ucsc.edu> Date: 19 Sep 90 22:15:27 GMT References: <139400009@uxa.cso.uiuc.edu> Sender: usenet@darkstar.ucsc.edu Organization: University of California, Santa Cruz Lines: 20 In article <139400009@uxa.cso.uiuc.edu> klg0582@uxa.cso.uiuc.edu writes: >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? > >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? The size difference is mostly due to the portions of the RTL getting linked in. Look at a linker map to get an idea as to what is taking up space. In particular, using printf will bring in a lot of code that you may be able to avoid by using more low-level output functions. Turbo Pascal has a "smart linker" which will ignore library routines if they are not referenced in your program. Unfortunately, this is made possible by the special nonstandard format of TPUs, and Turbo C and Turbo C++, which use the Microsoft OBJ format cannot do that so easily. -- sidney markowitz