This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Speeing up __cxa_atexit
On Thu, Jun 06, 2002 at 09:53:34PM -0700, Mark Mitchell wrote:
> --On Thursday, June 06, 2002 08:02:38 PM +0200 Gabriel Dos Reis
> <gdr@codesourcery.com> wrote:
> >
> > Certainly I don't undertand what is really going on, but I'm sure when
> > the user replaces malloc(), he/she invokes undefined behaviour.
>
> Very well.
>
> In practice, from a QOI point of view, we should try to support people
> replacing various C library functions, but I am happy to believe that
> they are not allowed to do so.
>
> Using "operator new" instead of "malloc" in my argument is fine.
I agree with Gaby that if the user replaces malloc /in the source code/, in
the same way that operator new is replaced, then undefined behavior happens.
But outside the realm of the language proper, users do things like
% g++ ..... -o a.out
% LD_PRELOAD=safetymalloc.so ./a.out
This also "replaces malloc," and in this discussion that may (or may not)
be a distinction we need to make; I don't know.
Phil
--
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams