C++ Logo

std-proposals

Advanced search

Re: dofor loop

From: John Yates <john_at_[hidden]>
Date: Fri, 27 Dec 2019 14:44:17 -0500
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

Received on 2019-12-27 13:47:00