Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!bbn!rochester!uhura.cc.rochester.edu!ur-valhalla!micropen!dave From: dave@micropen (David F. Carlson) Newsgroups: comp.lang.c Subject: Re: problem with cc compiler Summary: one way Message-ID: <809@micropen> Date: 27 Jul 89 15:39:04 GMT References: <712@unsvax.NEVADA.EDU> <10589@smoke.BRL.MIL> <1185@fcs280s.ncifcrf.gov> Organization: Micropen Direct Writing Systems, Pittsford, NY Lines: 32 In article <1185@fcs280s.ncifcrf.gov>, kml@ncifcrf.gov (Kevin Lahey) writes: ] In article <10589@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: ] >In article <712@unsvax.NEVADA.EDU> willey@arrakis.uucp (James P. Willey) says: ] >>... I finally realized that the function name "read" was the culprit. ] > ] >I assume that your problem was that getchar() eventually called read(), ] >expecting the version in the system's C library, but instead found one ] >you had written as part of your program. ] > ] ] then I could see how to avoid a collision. I just don't quite see ] how to insure that a regular function declaration doesn't override ] a library function. Assuming that this magic system works (I don't ] doubt that it does), how can one override a library function when desired? ] ] I made a brief perusal of the second edition of K & R, but I was ] not enlightened. Could you give me some pointers about where to look? ] Obviously, I'm not all up on the new ANSI-C stuff, but I want to be. One way available under sysV is to use the -M flag for ld(1). The loader will barf loudly if a duplicate extern reference occurs. This is not a language "problem" as much as it is a link-loader problem. C does allow implicit referencing and seperate compilation. (A programmer once named a function kill(). *Very* ugly things happened.) -- David F. Carlson, Micropen, Inc. micropen!dave@ee.rochester.edu "The faster I go, the behinder I get." --Lewis Carroll