C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] dofor loop
From: John Yates (john_at_[hidden])
Date: 2019-12-27 13:44:17


If `do` were to get an optional init-statement and `while` an optional
increment-statement then you could have:

  do [ (init-statement) ]
  {
    ...statements...
  } while (condition [ ; increment-statement ] )

/john

On Fri, Dec 27, 2019 at 11:39 AM Matthew Woehlke via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 27/12/2019 09.49, Thiago Macieira via Std-Proposals wrote:
> > Note: you're unlikely to get "dofor" as a keyword. Please investigate a
> new
> > syntax that does not involve a new keyword and does not break existing
> code.
>
> Well, *that* much is easy. If I understand what Menashe is asking for:
>
> do (init-statement)
> {
> ...statements...
> } for (condition; increment-statement)
>
> ...but is it worth it? I just don't know.
>
> (OTOH, I wouldn't mind `do` having an optional init-statement...)
>
> ...although that's very close to being an SC break, and I can already
> hear compiler vendors complaining about the necessary look-ahead :'(.
>
> --
> Matthew
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

-- 
John Yates
505 Tremont St, #803
Boston, MA 02116


STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups