Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!wuarchive!wugate!uunet!seismo!esosun!cogen!celerity!celit!ps From: ps@celerity.UUCP (Patricia Shanahan) Newsgroups: comp.std.c Subject: Re: restrictive linkers (was: Reserved names in ANSI C) Keywords: linkers, redux Message-ID: <388@celit.UUCP> Date: 25 Jul 89 17:51:38 GMT References: <2619@yunexus.UUCP> <547@cybaswan.UUCP> <12711@bloom-beacon.MIT.EDU> Sender: news@celerity Reply-To: ps@celerity (Patricia Shanahan) Organization: FPS Computing Inc., San Diego CA Lines: 66 In article <12711@bloom-beacon.MIT.EDU> scs@adam.pika.mit.edu (Steve Summit) writes: >Two minor points: > >In article <547@cybaswan.UUCP> iiit-sh@cybaswan.UUCP (Steve Hosgood) writes: >>In article <2619@yunexus.UUCP>, davecb@yunexus.UUCP (David Collier-Brown) writes: >>> 0) 6 characters is a lower limit of significance. You're allowed to use more. >>Yeah, but though you may be able to use more, a 'strictly conforming' program >>can't, otherwise it won't port to sites with 6-character linkers. > >Presumably the posters and most readers of this group understand >it, but there are apparently many who interpret statements like >the above to mean that external identifiers may not have more >than six characters at all. I'm always seeing subroutine >packages that have incredibly strained, abbreviated identifier >names, to keep them six characters long. You're allowed to use >extra characters for readability; the only problem is that if you >say > > int identifier1, identifier2; > >you may get > > "identi: multiply defined." > >It should be perfectly legal to say > > int identifier, anotheridentifier; I strongly dislike systems that accept extra characters in identifiers and ignore them. This feature creates a difference between the program as the programmer reads it, and the program as the compiler reads it. It can in fact move porting problems from compile time detection to run time errors. Suppose I have a large and complicated program that uses two libraries, libA and libB. Suppose also that identifier1 is the name of a function in libA and identifier2 is the name of a function in libB. A short identifier system that treats ignored characters in identifiers as an error will flag the use of more than six characters in the function names during the library make, and will also flag the use of the long names for external references during the compile. The problem will be found and easily fixed before the first successful make. A short identifier system that simply ignores excess characters will silently resolve references to both identifier1 and identifier2 to whichever appears in the first library examined. If you are lucky and have good tests, it will be found during program test. Even after the existence of the bug is known because of a crash or wrong result, it may still be difficult to fix. A programmer reading the code will see the correct function being called. If the system is sufficiently large, the programmer who is trying to fix a failure in a piece of code using identifier1 may not even be conciously aware of the existence of identifier2. If they do a grep for identifier1 it will not find identifier2. This is especially serious if the significant identifier length is scope dependent. The same type of problem can happen because the scope of a function has been changed from static to external and it has been moved to a library. Patricia Shanahan uucp : ucsd!celerity!ps arpa : ucsd!celerity!ps@nosc phone: (619) 271-9940