C++ Logo

std-proposals

Advanced search

Re: Remove infinite loop UB

From: connor horman <chorman64_at_[hidden]>
Date: Sun, 10 May 2020 15:43:08 -0400
This would depend on the implementation of the VBLANK.
I usually want to redraw the screen even if nothing changed.

Also, I'd add that apparently C does not have/no longer has this issue(at
least by C11, see
http://port70.net/~nsz/c/c11/n1570.html#6.8.5p6). Where the loop condition
of a for loop is a constant expression (empty conditions are included), the
loop cannot be assumed to terminate. I can't see much of a reason for this
to be different between the two languages.

On Sun, May 10, 2020 at 12:02 Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Corrections to some code. I got my conditions backwards:
>
> > //Spin to wait for VBlank routine
> > waiting_for_vblank = 1;
> > while(!waiting_for_vblank) {}
>
> The condition should be `while(waiting_for_vblank) {}`.
>
> Also:
>
> > //Busy loop 2:
> > waiting_for_vblank = 0;
> > while(waiting_for_vblank) {}
>
> The condition should be `while(!waiting_for_vblank) {}`.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2020-05-10 14:46:21