This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/23383] builtin array operator new is not marked with malloc attribute
- From: "xinliangli at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jun 2008 04:46:46 -0000
- Subject: [Bug c++/23383] builtin array operator new is not marked with malloc attribute
- References: <bug-23383-6528@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #8 from xinliangli at gmail dot com 2008-06-04 04:46 -------
(In reply to comment #6)
> This has been extensively discussed on the C++ reflector. They decided
> (informally, on the reflector) that people should be able to globally override
> operator new to do logging, etc, which can make malloc have arbitrary side
> effects.
>
yes, things like saving pointers to user visible locations are bad. In this
kind of situation, optimizer people's voice seems not loud enough :(.
One way to solve this problem is to require user who override the default
definition to always provide a declaration (before any use of operator new) --
if such declaration is not seen, the operator new will be treated as builtin
(the default) implementation which has the nice property.
David
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23383