#include <memory>
struct foo { };
int main() { std::make_shared<foo>(); }
The asssembly generated by g++7 -fno-exceptions -Ofast
for the code above:
-
Contains a single call to
operator new
if-fno-rtti
is not passed. -
Contains two separate calls to
operator new
if-fno-rtti
is passed.
This can be easily verified on gcc.godbolt.org:
Why is this happening? Why does disabling RTTI prevent make_shared
from unifying the object and control block allocations?
Aucun commentaire:
Enregistrer un commentaire