The free() thing and function names

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Sep 15 21:58:49 AEST 1989


In article <841 at uniol.UUCP> lehners at uniol.UUCP (Joerg Lehners) writes:
>Don't hardcode any (even standard) functions into the compiler.
>What about writing my own free() function, possibly with a completly
>different semantic ?

You absolutely must NOT do that in a hosted implementation.  Several
library routines may depend, not only on the documented semantics of
an external function named free(), but also on implementation-specific
internal properties of the free() implementation.  If you provide your
own external function named free(), you can break the implementation.

>What does the standard say about standardized function overriding ?

A program that does that is not strictly conforming.

>Maybe one have to distingish between
>   a.) C-Compiler: just the C keywords are reserved,
>       function overriding possible and possible more.
>   b.) C-System (C-Compiler plus standardized function package [often
>       called 'library']: C keywords reserved; return type, argument types
>       of standardized functions reserved; and more.

The Standard provides for two forms of conforming implementation:
"hosted" (for which the standard headers and standard library are
provided), and "free-standing" (which provides only minimal header
and library support).



More information about the Comp.lang.c mailing list