diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-02-04 21:39:11 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2024-02-08 21:32:42 +0000 |
commit | 4e5dc6d9686a34d446147b923fe838389758a512 (patch) | |
tree | 60df200ae6258d0f7cde4a819a7d2283cf073d10 | |
parent | 232ffb61ceb63c4a86a8bc67f1db989c2124db5f (diff) | |
download | gcc-4e5dc6d9686a34d446147b923fe838389758a512.zip gcc-4e5dc6d9686a34d446147b923fe838389758a512.tar.gz gcc-4e5dc6d9686a34d446147b923fe838389758a512.tar.bz2 |
libstdc++: Add comment to gslice::operator=(const gslice&) [PR100147]
There's no need to check for self-assignment here, it would just add
extra code for an unlikely case. Add a comment saying so.
libstdc++-v3/ChangeLog:
PR libstdc++/100147
* include/bits/gslice.h (operator=): Add comment about lack of
self-assignment check.
-rw-r--r-- | libstdc++-v3/include/bits/gslice.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/gslice.h b/libstdc++-v3/include/bits/gslice.h index 3d78da2..d9a8b92 100644 --- a/libstdc++-v3/include/bits/gslice.h +++ b/libstdc++-v3/include/bits/gslice.h @@ -169,6 +169,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline gslice& gslice::operator=(const gslice& __g) { + // Safe for self-assignment. Checking for it would add overhead just to + // optimize a case that should never happen anyway. if (__g._M_index) __g._M_index->_M_increment_use(); if (_M_index && _M_index->_M_decrement_use() == 0) |