From -4018914376042949345
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1149ec,f5b50f79e3b33c8d
X-Google-Attributes: gid1149ec,public
X-Google-Thread: f78e5,c0143c56db298752
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-09-10 16:09:08 PST
Newsgroups: comp.std.c,comp.std.c++
Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!zombie.ncsc.mil!cs.umd.edu!lhc!rubenst
From: rubenst%occs.nlm.nih.gov (Michael M. Rubenstein)
Subject: Re: malloc calls FROM the standard library (was: Re: Question on 5.2.3.)
Message-ID: <1994Sep10.033223.23015@nlm.nih.gov>
Followup-To: comp.std.c,comp.std.c++
Sender: news@nlm.nih.gov
Organization: National Library of Medicine
X-Newsreader: TIN [version 1.1 PL8]
References: <CvvDzK.2E8@cogsci.ed.ac.uk>
Date: Sat, 10 Sep 94 03:32:23 GMT
Lines: 29
Xref: nntp.gmd.de comp.std.c:7858 comp.std.c++:8933

Richard Tobin (richard@cogsci.ed.ac.uk) wrote:
> In article <MCOOK.94Sep9104817@galaga.lna.logica.com> michaelc@lna.logica.com writes:
> >    rfg> It's my understanding that nothing provided by the implementation is
> >    rfg> supposed to call malloc.

> This has already been corrected.

> >What would be the point of such a restriction?  If a library were to call
> >`malloc' directly, why would that preclude someone from replacing `malloc'
> >with their own implementation?

> The problem arises if library functions make use of undocumented
> features of the malloc implementation, which the users will not
> be able to replicate.

> It would be useful if implementations guaranteed that this was not the
> case; i.e. guaranteed that library functions only interact with each
> other through the standard interfaces.  It's probably too restrictive
> for the C standard to guaranteed this.

Even with that restriction, there would be a problem.  The standard does not
require that functions be packaged separately.  It is quite possible that
the runtime library packages other functions in with malloc and cannot
link them separately.  For example, if malloc() and calloc() were in the same
module and function level linking were not supported, replacing malloc()
would lose calloc().

--
Mike Rubenstein


