[PATCH v1] libstdc++: Rename _S-prefixed identifiers in <mdspan>.
Jonathan Wakely
jwakely@redhat.com
Wed Sep 10 09:24:36 GMT 2025
On Wed, 10 Sept 2025 at 09:44, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Wed, 10 Sept 2025 at 07:49, Luc Grosheintz <luc.grosheintz@gmail.com> wrote:
> >
> > In libstdc++ the prefix _S is used for static members only. In <mdspan>
> > there's several type aliases that also used the prefix _S. They now use
> > double underscore instead.
>
> Thanks for revisiting these.
>
> >
> > libstdc++-v3/ChangeLog:
> >
> > * include/std/mdspan (_ExtentsStorage::__base): New name for
> > _S_base.
> > (_ExtentsStorage::__storage_type): New name for _S_storage.
> > (extents::__storage_type): New name for _S_storage.
> > (layout_stride::mapping::__strides_type): New name for
> > _S_stries_t.
> > * testsuite/23_containers/mdspan/class_mandate_neg.cc: Update
> > test to the new error message.
> >
> > Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
> > ---
> > libstdc++-v3/include/std/mdspan | 33 ++++++++++---------
> > .../23_containers/mdspan/class_mandate_neg.cc | 2 +-
> > 2 files changed, 18 insertions(+), 17 deletions(-)
> >
> > diff --git a/libstdc++-v3/include/std/mdspan b/libstdc++-v3/include/std/mdspan
> > index 678b2619ebe..f0139a95b11 100644
> > --- a/libstdc++-v3/include/std/mdspan
> > +++ b/libstdc++-v3/include/std/mdspan
> > @@ -148,14 +148,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> > class _ExtentsStorage : public _StaticExtents<_Extents>
> > {
> > private:
> > - using _S_base = _StaticExtents<_Extents>;
> > + using __base = _StaticExtents<_Extents>;
>
> Looking through the other headers, we usually use _Base for this case,
> and for other typedefs that are private to the class (and its
> friends).
>
> Yes, that's inconsistent with __type that we use in some internal type
> traits, but in those cases __type is public and we intend it to be
> used from outside the class, by code using it. e.g. constant_wrapper
> uses _CwFixedValue::__type.
I should make some updates to
https://gcc.gnu.org/onlinedocs/libstdc++/manual/source_code_style.html
to cover this.
And turn that numbered list into a proper DocBook <variablelist>, and
remove number 10 (about prefixing members with 'this->' because of
Koenig lookup, which is just wrong).
More information about the Libstdc++
mailing list