This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc/free & new/delete balance
- To: Carlo Wood <carlo at runaway dot xs4all dot nl>
- Subject: Re: malloc/free & new/delete balance
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 29 Jun 1998 21:54:36 -0300
- Cc: egcs at cygnus dot com (egcs at cygnus dot com)
- References: <199806291141.NAA19053@jolan.ppro>
Carlo Wood <carlo@runaway.xs4all.nl> writes:
> WEAK (void operator delete[] (void *ptr) throw ())
> {
> if (ptr)
> free (ptr);
> }
> This unbalance between calling `::operator new(size_t)' and `free(void *)'
> is causing troubles when `operator new(size_t)' and `operator delete(void *)'
> are overloaded
Agreed, but, for some reason, the FDIS [lib.new.delete.array] defines
operator new[](size_t) as returning operator new(size_t) by default,
while it states that operator delete[](void*) frees the pointer it is
given. So, I'd say the implementation is correct, and calling
operator delete(void*) is non-standard. Too bad. :-(
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil