logoalt Hacker News

omoikanetoday at 3:56 PM0 repliesview on HN

> The loop must be a trivially empty iteration statement -- meaning its body is literally empty

This seems to say that the loop body can not be "continue". Indeed, I just tried -std=c++26 with ";" and got an infinite loop as promised, but "continue" restores the undefined behavior:

- "while(true);" -> https://godbolt.org/z/T65o51crx

- "while(true) continue;" -> https://godbolt.org/z/Pj9raEcnP

This is unfortunate since I know of one style guide that prefers "continue" over single semicolons. I guess all those code will be doing "while(true) {}" from now on.

https://google.github.io/styleguide/cppguide.html#Formatting...