Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!asuvax!noao!arizona!sunquest!ggg From: ggg@sunquest.UUCP (Guy Greenwald) Newsgroups: comp.lang.c Subject: Re: problem with cc compiler Summary: Hide the duplicate RTL declaration Message-ID: <175@sunquest.UUCP> Date: 27 Jul 89 19:23:43 GMT References: <712@unsvax.NEVADA.EDU> <10589@smoke.BRL.MIL> <4935@alvin.mcnc.org> Organization: Sunquest Information Systems, Tucson Lines: 30 In article <4935@alvin.mcnc.org>, spl@mcnc.org (Steve Lamont) writes: > Suppose that I wish to implement my own math library function, say sin() or > cos(), for whatever reason, in a large pre-existing piece of code that I don't > want to fiddle too much with. How would I do this, then? Declare the routine name before it is invoked, then define the routine to be static. Here's an example: main() { /* Declare the function here */ double sin(); double x, something; /* ... code ... */ x = sin(something); } static double sin(angle) double angle; { double value; /* Steve's slick sine calculation */ return value; } It is the combination of the static definition and the declaration before use that avoids the problem with the duplicate name in the run-time library.