Xref: utzoo comp.software-eng:2678 comp.misc:7673 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!swrinde!emory!mephisto!ncsuvx!mcnc!rti!xyzzy!meissner From: meissner@dg-rtp.dg.com (Michael Meissner) Newsgroups: comp.software-eng,comp.misc Subject: Re: Coding standards (was Re: Programmer productivity) Message-ID: Date: 14 Dec 89 14:40:15 GMT References: <34796@regenmeister.uucp> <2226@jato.Jpl.Nasa.Gov> <128179@sun.Eng.Sun.COM> <546@sagpd1.UUCP> <4727@netcom.UUCP> <4290@pegasus.ATT.COM> <9185@hoptoad.uucp> <600@fred.UUCP> Sender: usenet@xyzzy.UUCP Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 54 In-reply-to: bill@polygen.uucp's message of 5 Dec 89 15:17:34 GMT In article <600@fred.UUCP> 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. I suspect that most real world linkers work the way UNIX does (with regard to loading the entire contents of an object file, instead of just the 'functions' that are needed). However, if the linker is this 'helpful', it breaks a debugging paradim that we in DG langauges and also GNU C use. Mainly, you include some functions that are otherwise unused in the program that take a pointer to some internal datatype, and prints the datatype out in an implementation defined manner. For example here is a fragment of a dbx debugging session on GCC that calls the function 'debug_rtx' to print out an RTL tree (reformatted to fit in 80 columns): (2) Stopped in final (first=(rtx) 0x412010, file=(struct FILE *) 0x405820, write_symbols=NO_DEBUG, optimize=0, prescan=0), file final.c, line 537 537 insn = final_scan_insn (insn, file, write_symbols, optimize, (dbx) print insn insn = (rtx) 0x4121b8 (dbx) print debug_rtx(insn) (insn 7 6 8 (set (reg:SI 2) (symbol_ref:SI ("*@LC0"))) 89 (nil) (nil) (nil)) debug_rtx(insn) = 1 (dbx) -- -- Michael Meissner, Data General. Until 12/15: meissner@dg-rtp.DG.COM After 12/15: meissner@osf.org