Xref: utzoo comp.software-eng:2640 comp.misc:7618 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.software-eng,comp.misc Subject: Re: Coding standards (was Re: Programmer productivity) Keywords: One function per file? Message-ID: <9220@hoptoad.uucp> Date: 8 Dec 89 06:56:59 GMT References: <34796@regenmeister.uucp> <600@fred.UUCP> Organization: Eclectic Software, San Francisco Lines: 34 In article <4290@pegasus.ATT.COM> dmt@pegasus.ATT.COM (Dave Tutelman) writes: >There IS one argument, in some cases a compelling one, for "one function >per file". In general, linkers aren't smart enough to link just >PART of a binary file (.OBJ or .o), when that file contains a function >needed by the link. In article <9185@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >WHAT? What year is this? I don't think I've ever used a linker that >didn't eliminate unused routines. Any such linker would be seriously >brain damaged. bill@polygen.uucp (Bill Poitras) wrote: > Yes you have. ANY linker you have does this. What you are thinking of is > a LIBRARY, ie. .lib file. (lib*.a if you're a Unix person), which when used in > the link process, only the functions used in the program begin linked, get > linked. The linkers I use every day on the Macintosh routinely remove all unreferenced routines from output files. On the other hand, it turns out that very few, if any, UNIX linkers do this. I *have* used UNIX linkers (I used to use them all the time, in fact), so my impression was incorrect, as a number of people have kindly informed me by e-mail. I was going to apologize, but I've just read all ten pages of the ld(1) manual page, and it never explicitly says this, so I feel justified in the error. I'm not used to Mac development tools being smarter than UNIX! -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com FROM THE FOOL FILE: "The men promise to provide unconditionally for their wives. The women in turn serve unconditionally to provide the other household services necessary for the men to fulfill their obligations to the women. The women are satisfied because they have the men working for THEM." -- Colin Jenkins, soc.women