Why use infinite loops?

前端 未结 14 1959
轮回少年
轮回少年 2021-02-08 13:33

Another poster asked about preferred syntax for infinite loops.

A follow-up question: Why do you use infinite loops in your code? I typically see a construct like

14条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-08 14:05

    while( 1 )
    {
        game->update();
        game->render();
    }
    

    Edit: That is, my app is fundamentally based around an infinite loop, and I can't be bothered to refactor everything just to have the aesthetic purity of always terminating by falling off the end of main().

提交回复
热议问题