Xref: utzoo comp.unix.wizards:23584 comp.lang.c:31317 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!samsung!uunet!mcsun!ukc!pyrltd!root44!gwc From: gwc@root.co.uk (Geoff Clare) Newsgroups: comp.unix.wizards,comp.lang.c Subject: Re: OK, so why _does_ ld resolve text against data? Message-ID: <2395@root44.co.uk> Date: 23 Aug 90 13:19:38 GMT References: <1990Jul30.104726.22660@mtcchi.uucp> <37909@ucbvax.BERKELEY.EDU> <930@eplunix.UUCP> <38343@ucbvax.BERKELEY.EDU> Followup-To: comp.lang.c Organization: UniSoft Ltd., London, England Lines: 34 In <38343@ucbvax.BERKELEY.EDU> edward@ucbarpa.Berkeley.EDU (Edward Wang) writes: >Why stop there, why not redefine index() while you're at it? >Defining index to be a variable is easy to debug. It'll most likely >core dump on the call. Unintentionally redefining index to be a function >of exactly the same type, arguments and all, is uncatchable and much harder >to debug. It's not hard to catch at all. In fact it is impossible to miss: $ cat tmp.c char *index(string, chr) char *string; char chr; { *string = chr; return string; } main() { (void) index("a", 'a'); return 0; } $ lint tmp.c tmp.c: index multiply declared tmp.c(4) :: llib-lc(269) $ ^D [This doesn't belong in unix.wizards any more: I have directed followups only to comp.lang.c] -- Geoff Clare (Dumb American mailers: ...!uunet!root.co.uk!gwc) UniSoft Limited, Hayne Street, London EC1A 9HH, England. Tel: +44-71-315-6600