Micro-optimisation in <ext/rope.h> ?

Jonathan Wakely jwakely@redhat.com
Tue Dec 9 15:19:00 GMT 2014


What's this for?

#ifdef __EXCEPTIONS
      _Rope_self_destruct_ptr() : _M_ptr(0) { };
#else
      _Rope_self_destruct_ptr() { };
#endif

Are we really just trying to avoid setting a pointer to zero for the
case where the object won't get destroyed by stack-unwinding?

<ext/ropeimpl.h> seems to do the same:

#if !defined(__GC) && defined(__EXCEPTIONS)
    __forest[__i] = 0;
#endif

In the interests of simplicity I think we should just zero those
pointers even when exceptions are disabled. And the default
constructor could just be removed, it isn't used anywhere!

I'll try to remember to come back to this in stage1 next year.



More information about the Libstdc++ mailing list