[Bug libstdc++/59894] Force use of the default new/delete
trippels at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 20 21:57:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59894
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |trippels at gcc dot gnu.org
--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #0)
> operator new and operator delete are hidden in libsupc++ so they can be
> easily replaced, either directly in the code, or later by interposing a
> library. Doing so has a cost, and I have seen people (and done it myself)
> providing a definition in their code that was roughly equivalent to the
> standard one, just so it could be inlined.
Isn't inlining forbidden by the standard?
(see also http://cplusplus.github.io/LWG/lwg-defects.html#404)
quote:
17.6.4.6 Replacement functions
[replacement.functions]
Clauses 18 through 30 and Annex D describe the behavior of numerous functions
defined by the C ++ standard
library. Under some circumstances, however, certain of these function
descriptions also apply to replacement
functions defined in the program (17.3).
A C ++ program may provide the definition for any of eight dynamic memory
allocation function signatures
declared in header <new> (3.7.4, 18.6):
— operator new(std::size_t)
— operator new(std::size_t, const std::nothrow_t&)
— operator new[](std::size_t)
— operator new[](std::size_t, const std::nothrow_t&)
— operator delete(void*)
— operator delete(void*, const std::nothrow_t&)
— operator delete[](void*)
— operator delete[](void*, const std::nothrow_t&)
The program’s definitions are used instead of the default versions supplied by
the implementation (18.6).
Such replacement occurs prior to program startup (3.2, 3.6). The program’s
definitions shall not be specified as inline. No diagnostic is required.
More information about the Gcc-bugs
mailing list