Xref: utzoo comp.software-eng:2630 comp.misc:7607 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!snorkelwacker!mit-eddie!apollo!perry From: perry@apollo.HP.COM (Jim Perry) Newsgroups: comp.software-eng,comp.misc Subject: Re: Coding standards (was Re: Programmer productivity) Message-ID: <4748ed31.20b6d@apollo.HP.COM> Date: 7 Dec 89 15:17:00 GMT Sender: root@apollo.HP.COM Organization: Hewlett-Packard Apollo Division - Chelmsford, MA Lines: 43 bill@polygen.uucp (Bill Poitras) writes: >In article <9185@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >%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. >% >%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. >%-- >%Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com >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. Although I'm not a compiler/linker expert, I almost positive that >this is true. This is true only in the very narrow context of UNIX; in more advanced systems (both predating and postdating UNIX) the output of the compilers (foo.o or a.out in UNIX terms) is what you think of as a library, and the associated linkers/loaders/library editors can do the right thing, for instance doing type-checking on cross-module function calls, but certainly including only procedures and data that are actually referenced. On another point, speaking of a.out, it's relatively rare in the world at large for compilers to generate *assembly source*; that's another UNIXism. (They compile directly to the appropriate machine language -- in a relocatable library form, of course). People on both sides are surprised by this, for some reason. Anyway, I suspect there may be some relation between this issue and the object module thing, but I don't know for sure. It's also true that the traditional UNIX philosophy calls for multiple simple tools rather than complex tools, and ease of writing over ease or efficiency of use; thus rather than a cc that knows about libraries, you have cpp/cc/as/ar/ranlib. Easier to write and almost as good. (Or, if you will, "brain damaged" :-). - Jim Perry perry@apollo.hp.com HP/Apollo, Chelmsford MA This particularly rapid unintelligible patter isn't generally heard and if it is it doesn't matter.