problem with cc compiler

Kevin Lahey kml at ncifcrf.gov
Mon Jul 24 05:46:34 AEST 1989


In article <10589 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <712 at unsvax.NEVADA.EDU> willey at 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.
>
>Standard-conforming C implementations are quite constrained in this
>regard, and would not have invoked your read() function by mistake.

Yow!  Could you elaborate on this?  I don't quite understand. 

Certainly, had he made a declaration:

static read () { blah blah }

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.

Thanks,
Kevin

kml at fcs280s.ncifcrf.gov         NCI Supercomputer Center, Frederick, Maryland
kml at mosquito.cis.ufl.edu        UF CIS Department, Gainesville, Florida 
 
Whenever you find that you are on the side of the majority, it is time 
to reform.               -- Mark Twain



More information about the Comp.lang.c mailing list