C++ Logo

std-discussion

Advanced search

Re: Earliest version with vector::data

From: Hans Åberg <haberg-1_at_[hidden]>
Date: Tue, 17 Aug 2021 15:40:26 +0200
> On 17 Aug 2021, at 15:26, Edward Catmur <ecatmur_at_[hidden]> wrote:
>
> On Tue, 17 Aug 2021 at 14:22, Hans Åberg <haberg-1_at_[hidden]> wrote:
>
> > On 17 Aug 2021, at 15:13, Edward Catmur <ecatmur_at_[hidden]> wrote:
> >
> > On Tue, 17 Aug 2021 at 14:02, Hans Åberg via Std-Discussion <std-discussion_at_[hidden]> wrote:
> >
> > > On 17 Aug 2021, at 11:23, Daniel Krügler <daniel.kruegler_at_[hidden]> wrote:
> > >
> > > Am Di., 17. Aug. 2021 um 10:48 Uhr schrieb Hans Åberg via
> > > Std-Discussion <std-discussion_at_[hidden]>:
> > >>
> > >> Which is the earliest C++ version of which vector::data should be considered a part? —It is not in the ISO+IEC+14882-1998 document, but there is a proposal from 2004 to add it.
> > >>
> > >> https://cplusplus.github.io/LWG/issue464
> > >
> > > It should be guaranteed to be specified in the C++11 standard, but the
> > > C++ committee has voted the above-mentioned issue into CD1 in 2008. So
> > > some vendors may have added this function even in C++03 mode (in case
> > > they have updated their library implementations), but you cannot rely
> > > on that.
> >
> > The issue is with GNU Bison that writes C++ parser files intended to compile with several C++ versions. Then GCC 4.2 from 2007-2008 has C++98, but does not have vector::data. Is that correct?
> >
> > That seems unlikely to be correct. godbolt.org does not have gcc 4.2, but it has gcc 4.1.2 (from 2006), and that has vector::data.
> >
> > https://github.com/gcc-mirror/gcc/commit/8b5f07a224611f7dcff90910b493b93c2ef0c6b8 indicates that the earliest gcc release that contains it is gcc 4.1.0.
>
> It is the version supplied on MacOS. At some point gcc switched to point to their inhouse version of clang.
>
> It's entirely possible that Apple shipped gcc 4.2 along with an older version of libstdc++. You should probably check with them (i.e. Apple).

They do not document such things and they hide which version of clang their inhouse version is based on, so that would likely be futile. It is a very old version of GCC but it was the last real one supplied with the platform I think, so it then has some significance. Better to use the latest version of the real GCC or Clang, which are supported by for example MacPorts.

Received on 2021-08-17 08:40:33