------- 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