Logo

Programming-Idioms

History of Idiom 50 > diff from v9 to v10

Edit summary for version 10 by :

Version 9

2015-08-20, 11:19:31

Version 10

2015-08-20, 11:20:48

Idiom #50 Make an infinite loop

Write a loop which has no end clause.

Idiom #50 Make an infinite loop

Write a loop which has no end clause.

Imports
#define forever while(1)
Imports
#define forever while(1)
Code
while(1)
{
}

while(1);

for(;;)
{
}

for(;;);

forever
{
}

forever;
Code
forever {
	// Do something
}
Comments bubble
With and without block, both is possible.

forever can be defined as a preprocessor constant to improve readability.
Comments bubble
forever can be defined as a preprocessor constant to improve readability.

Block curly braces are optional.