This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] Less noexcept
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 23 Sep 2013 22:44:16 +0200 (CEST)
- Subject: Re: [v3] Less noexcept
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1309231727470 dot 4526 at stedding dot saclay dot inria dot fr> <52406C81 dot 3010106 at oracle dot com> <alpine dot DEB dot 2 dot 10 dot 1309231947130 dot 4088 at laptop-mg dot saclay dot inria dot fr> <52409856 dot 1000902 at oracle dot com> <5240A0D4 dot 1030603 at oracle dot com>
On Mon, 23 Sep 2013, Paolo Carlini wrote:
Hi again,
It is funny that with fully dynamic strings, the copy constructor is
"better" than the move constructor: faster, doesn't throw, etc. I think we
should remove the move constructor in that case, or at least make it act
the same as the copy constructor. I didn't mark the copy constructor as
noexcept, but without checking the code it seems likely we could.
I took a look at the code. First I got a headache because of the allocator
stuff. And once the paracetamol started helping, I noticed that the
is_leaked mechanism means it can throw anyway, so I was wrong.
We could, but in my opinion fiddling with those isn't worth the trouble,
because the whole "fully dynamic string" thing is just a workaround for
issues of the current reference counted implementation vs the statically
allocated empty string on some targets.
Well, I have a second (practical) thought about this part. If you are willing
to spend a little more time on this, and can confirm your preliminary
analysis about copy-constructor vs move-constructor, first blush it
definitely makes sense to me, I'm certainly not against your proposal of
having the move-constructor identical to the copy-constructor in that case.
In 4.9.x some targets, not Linux, would benefit from it.
Sorry.
--
Marc Glisse