Xref: utzoo comp.unix.wizards:23568 comp.lang.c:31297 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!lll-winken!sun-barr!newstop!sun!adapt!linden From: linden@adapt.Sun.COM (Peter van der Linden) Newsgroups: comp.unix.wizards,comp.lang.c Subject: Re: OK, so why _does_ ld resolve text against data? Message-ID: <141151@sun.Eng.Sun.COM> Date: 22 Aug 90 18:38:42 GMT References: <1990Jul30.104726.22660@mtcchi.uucp> <37909@ucbvax.BERKELEY.EDU> <930@eplunix.UUCP> Sender: news@sun.Eng.Sun.COM Reply-To: linden@eng.sun.com (Peter van der Linden) Organization: Sun Microsystems, Mountain View Lines: 20 David Steffens points out a serious deficiency in "ld", and in fact it's even more heinous than the example he gives. If you happen to choose a function name that duplicates a library name, then your function is used in preference to the library function both in your code AND in any library routines you call! Most of us know to avoid names like malloc, but everyone calls something index sooner or later. This has tremendous potential for mysterious bugs, and I see it 4 or 5 times a year. The first time a programmer encounters it is an enlightening and "character-building" experience. ld should definitely be enhanced to complain about duplicate references in libraries (possibly with an option "shut up -- I meant to do this"). ---------------- Peter van der Linden linden@eng.sun.com (415) 336-6206 The antlers of the largest Irish Elk in the world are at Yale, and those of the smallest are at Harvard.