The free() thing and function names

Richard Tobin richard at aiai.ed.ac.uk
Wed Sep 20 01:26:17 AEST 1989


In article <11073 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>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.  

This is a real pain for programs (like interpreters for other languages)
that need to keep track of just what memory is in use.  A helpful
implementation would at least provide a way of producing code that
relied only on the advertised semantics of malloc(), etc, perhaps by
means of a compiler flag.

[Incidentally, if Joerg Lehners really wants "completely different"
semantics for free - rather than just say keeping a note of whats been
freed in addition to freeing the block - then he's going to lose!]

I hope that this will be treated as a "quality of implementation"
issue.

-- Richard

-- 
Richard Tobin,                       JANET: R.Tobin at uk.ac.ed             
AI Applications Institute,           ARPA:  R.Tobin%uk.ac.ed at nsfnet-relay.ac.uk
Edinburgh University.                UUCP:  ...!ukc!ed.ac.uk!R.Tobin



More information about the Comp.lang.c mailing list