The free() thing and function names

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Sep 17 09:57:21 AEST 1989


In article <1989Sep15.183248.2955 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>In article <841 at uniol.UUCP> lehners at uniol.UUCP (Joerg Lehners) writes:
>>What does the standard say about standardized function overriding ?
>The answer is a little complicated.  Assuming you just want to use a
>standard function's name for your own purposes, you can always do this
>provided (a) it doesn't begin with __ or _[A-Z], and (b) you do not
>#include the standard header declaring that function.

No, that's wrong.  All identifiers in section 4 with external linkage
(e.g. library function names) are reserved whether or not the associated
header is included.  It's only macros that are not reserved when the
header is not included.  See 4.1.2.1.

>ANSI C essentially demands that scanf() not call atof() at all, ...

No, in fact one of the main reasons the standard functions are reserved
is so the implementation of other standard library routines may safely
use them.  What you were saying is true only of NON-standard library
functions such as read().  "read" as an external identifier is reserved
for the application's own use; the standard library implementation must
not invoke the application's read() function (or data object!) in place
of whatever it is expecting to use to read from files.  Thus, POSIX
implementations of Standard C will have library routines such as scanf()
invoking __read() or some such reserved name instead.



More information about the Comp.lang.c mailing list