Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!ames!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: The free() thing and function names Message-ID: <29562@news.Think.COM> Date: 15 Sep 89 20:25:14 GMT References: <1989Sep14.022055.5961@twwells.com> <841@uniol.UUCP> <11073@smoke.BRL.MIL> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 35 In article <11073@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >In article <841@uniol.UUCP> lehners@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. I thought implementation-provided libraries were required to use an internal, underscore-prefixed name for all the standard library functions, precisely to allow users to override the normal names. >>What does the standard say about standardized function overriding ? > >A program that does that is not strictly conforming. I thought you were allowed to do this, provided you first #undefine the name. Implementations are permitted to implement any of the standard library functions as macros; if an implementation wished to open-code certain library calls, it would define them as macros for implementation-dependent keywords (in the underscore-prefixed namespace, which the standard explicitly reserves for the implementation) which are recognized by the compiler. I remember these rules being discussed quite a bit a few years ago. Did they not make it into the pANS? Barry Margolin Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar