>> From db5036e40ed7ac43b66ca74c44ec8d0bdc934b07 Mon Sep 17 00:00:00 2001 >> From: AdityaK >> <1108430...@users.noreply.github.com<mailto:1108430...@users.noreply.github.com>> >> Date: Sun, 29 Dec 2024 18:14:29 -0800 >> Subject: [PATCH] libstdc++: Use string::push_back instead of >> string::operator+= >> >> operator+= returns string& which is ignored anyways.
>Why does this matter? The compiler can see that the return value isn't used. >Using += seems more readable to me. nvm, i see both produce the same code. sorry for the noise. ________________________________ From: Aditya K <hiradi...@msn.com> Sent: Tuesday, January 14, 2025 12:05 PM To: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>; libstd...@gcc.gnu.org <libstd...@gcc.gnu.org> Cc: jwak...@redhat.com <jwak...@redhat.com> Subject: Re: [PATCH] libstdc++: Use string::push_back instead of string::operator+= pinging in case this was missed. ________________________________ From: Aditya K <hiradi...@msn.com> Sent: Sunday, December 29, 2024 6:36 PM To: gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>; libstd...@gcc.gnu.org <libstd...@gcc.gnu.org> Cc: jwak...@redhat.com <jwak...@redhat.com> Subject: [PATCH] libstdc++: Use string::push_back instead of string::operator+= >From db5036e40ed7ac43b66ca74c44ec8d0bdc934b07 Mon Sep 17 00:00:00 2001 From: AdityaK <1108430...@users.noreply.github.com> Date: Sun, 29 Dec 2024 18:14:29 -0800 Subject: [PATCH] libstdc++: Use string::push_back instead of string::operator+= operator+= returns string& which is ignored anyways. --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/include/bits/basic_string.tcc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9ab5eeb55a5..be90bfd47e8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2024-12-29 Aditya Kumar <hiradi...@msn.com> + * include/bits/basic_string.tcc (getline): Use string::push_back + instead of string::operator+= + + 2024-12-29 Gerald Pfeifer <ger...@pfeifer.com> * doc/html/manual/profile_mode_diagnostics.html: Delete. diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index caeddaf2f5b..ddb41c8e7e2 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -935,7 +935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION && !_Traits::eq_int_type(__c, __eof) && !_Traits::eq_int_type(__c, __idelim)) { - __str += _Traits::to_char_type(__c); + __str.push_back(_Traits::to_char_type(__c)); ++__extracted; __c = __in.rdbuf()->snextc(); } -- 2.47.1.613.gc27f4b7a9f-goog