Logo

Programming-Idioms

History of Idiom 50 > diff from v68 to v69

Edit summary for version 69 by programming-idioms.org:
[C++] Warning: infinite loop without side-effects is undefined behaviour.

Version 68

2021-05-25, 11:43:50

Version 69

2021-05-25, 11:44:14

Idiom #50 Make an infinite loop

Write a loop which has no end clause.

Ouroboros eating its own tail

Idiom #50 Make an infinite loop

Write a loop which has no end clause.

Ouroboros eating its own tail
Code
while (true) {
	// Do something
}
Code
while (true) {
	// Do something
}
Comments bubble
You may remove the curly braces if the block is only 1 instruction.

The compiler might warn you that the loop expression is never false.
Comments bubble
You may remove the curly braces if the block is only 1 instruction.

The compiler might warn you that the loop expression is never false.

Warning: infinite loop without side-effects is undefined behaviour.