Date: Fri, 30 Apr 2021 10:47:05 +0300
On Fri, 30 Apr 2021 at 10:32, Uecker, Martin
<Martin.Uecker_at_[hidden]> wrote:
>
> Am Donnerstag, den 29.04.2021, 20:56 -0400 schrieb Bjarne Stroustrup:
> > I'd express that as "C++ has tried to limit the use of built-in arrays
> > to their natural domain of modeling fixed-sized contiguous sequences of
> > objects in memory."
>
> C++ also has
>
> std::array
>
> which also simple describes fixed-size contiguous sequences
> of objects in memory.
Right, and with std::span and std::mdspan, the domain where C arrays
would be used by C++ programmers
becomes very small to the point of being just an implementation detail
of some library types.
> I understand why one would like a type with more regular
> syntax and properties which fit in better with template
> mechanisms. But I wonder whether this needs to be a separate
> and incompatible type? Also maybe C style arrays could
> be made to fit in better with the rest of the types.
Right, that's been a "maybe" for decades. :) Meanwhile, the standard
library of C++ has just
been chugging along, first with std::vector, then std::array, then
std::span, then std::mdspan.
> Then, of course, in C there are also arrays of run-time bound
> which are extremely useful for bounds checking and multi-dimensional
> array (some C++ compilers have them as extensions). Everything
> proposal have seen for C++ so far which tries to address this
> problem in a different way seems to be inferior to me.
Right, attempts to introduce VLAs into C++ have failed. Some software
shops get rid of VLAs
as well with a different trade-off - by using an allocator.
<Martin.Uecker_at_[hidden]> wrote:
>
> Am Donnerstag, den 29.04.2021, 20:56 -0400 schrieb Bjarne Stroustrup:
> > I'd express that as "C++ has tried to limit the use of built-in arrays
> > to their natural domain of modeling fixed-sized contiguous sequences of
> > objects in memory."
>
> C++ also has
>
> std::array
>
> which also simple describes fixed-size contiguous sequences
> of objects in memory.
Right, and with std::span and std::mdspan, the domain where C arrays
would be used by C++ programmers
becomes very small to the point of being just an implementation detail
of some library types.
> I understand why one would like a type with more regular
> syntax and properties which fit in better with template
> mechanisms. But I wonder whether this needs to be a separate
> and incompatible type? Also maybe C style arrays could
> be made to fit in better with the rest of the types.
Right, that's been a "maybe" for decades. :) Meanwhile, the standard
library of C++ has just
been chugging along, first with std::vector, then std::array, then
std::span, then std::mdspan.
> Then, of course, in C there are also arrays of run-time bound
> which are extremely useful for bounds checking and multi-dimensional
> array (some C++ compilers have them as extensions). Everything
> proposal have seen for C++ so far which tries to address this
> problem in a different way seems to be inferior to me.
Right, attempts to introduce VLAs into C++ have failed. Some software
shops get rid of VLAs
as well with a different trade-off - by using an allocator.
Received on 2021-04-30 02:47:18