problem with cc compiler
Doug Gwyn
gwyn at smoke.BRL.MIL
Mon Jul 24 13:15:15 AEST 1989
In article <1185 at fcs280s.ncifcrf.gov> kml at ncifcrf.gov (Kevin Lahey) writes:
>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?
A standard-conforming implementation is not allowed to call functions
other than those specified as being in the standard library and others
(primarily with names beginning with underscore) that are specifically
reserved for the implementation by the Standard. read() is an example
of a function that a conforming C implementation must permit applications
to use for their own purposes.
A strictly conforming program is not allowed to provide its own version
of any of the standard library functions. Primarily this is because
such a substitution may well break the implementation, especially when
there are internal implementation constraints of which the application
programmer is unaware. (It does happen.) read(), however, is not a
standard C library function, although in an IEEE 1003.1 environment
read() is assumed to be available from the library. Implementations
that are simultaneously ANSI C and IEEE 1003.1 conforming will provide
read() in their C library, but will invoke a different name such as
_read() from within their stdio functions or use some other similar
scheme to avoid calling a user-provided read() function.
If you were designing a language from scratch, there would be much
better means available to avoid name collision. Ada "packages" are an
example of such a mechanism. However, we're stuck with C as it has
historically evolved, and the proposed Standard has gone about as far
as feasible in this direction.
More information about the Comp.lang.c
mailing list