This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Allow moved-from strings to be non-empty


On 26/10/18 08:25 +0200, Marc Glisse wrote:
On Fri, 26 Oct 2018, Jonathan Wakely wrote:

For the libc++ string zeroing the length of a small string happens to
be faster.

Ah, yes, of course.

Is it? In debug mode, I'd be tempted to leave the string as "moved" (size 5, short string so there is no allocation).

That's not a bad idea.

Although we can't do it for std::wstring and std::u32string, as their
small string buffer is *very* small.

"N/A"? The proposition was only semi-serious.

By the way, I was surprised by the formula for the size of the buffer. It often has size 16, but for a _CharT of size 3 and alignment 1 (unlikely I guess), it has size 18.

Oops, that's not intentional.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]