C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Array Index in Range-based For Loops

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Fri, 3 Mar 2023 09:58:59 +0000
On Fri, 3 Mar 2023 at 09:53, Andrey Semashev via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 3/3/23 12:30, Sebastian Wittmeier via Std-Proposals wrote:
> > Hi Andrey,
> >
> > you may have good reasons for not yet supporting/using some new features
> > like modules in your C++ development environment yet.
> >
> > And this well explains your stance in regards to using enumerate in this
> > case.
> >
> > However, for specifying C++26 and beyond modules should IMHO be
> > considered as the default, when talking about small improvements (saving
> > a few characters to define/increment a loop variable), especially if a
> > compatible header solution exists at the same time.
>
> Standard library module is not available in the currently released (and
> AFAIK next to be released) versions of gcc, which means it probably
> won't be released this year. The compiler version with the module
> support needs to ship in a mainstream Linux OS like Debian or RHEL to
> become relevant, and users, including me should shift from OS versions
> that use older compilers that don't have modules (because conditionally
> using modules is not worth it), so at the very least 5 years, most
> likely more.
>

Why do you think a new loop variable language feature added to C++26 would
be available any sooner?


>
> But most importantly, if modules have a problem with both importing and
> including the same stuff (which will happen if you use libraries that
> have not switched to modules),


Not necessarily.


> if modules have a problem with macros, or
> if `import std` is more expensive than `#include <cstddef>` (or pick any
> other lightweight header) then modules are DOA and I'm not seeing myself
> using them ever.
>

"if `import std` is more expensive than `#include <cstddef>`" is absurd,
most programs use a lot more from the standard library than that. If you
don't want to include more than that, that's fine. But you don't get to
argue against new library features on the basis that you've made personal
choices that most people would consider a silly self-imposed limitation.

This is std-proposals, not std-masochism.

Received on 2023-03-03 09:59:14