Logo

Programming-Idioms

History of Idiom 50 > diff from v5 to v6

Edit summary for version 6 by :

Version 5

2015-08-20, 10:53:52

Version 6

2015-08-20, 10:54:28

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);

forever
{
}

forever;
Code
while(1)
{
}

while(1);

for(;;)
{
}

for(;;);

forever
{
}

forever;
Comments bubble
With and without block, both is possible.

forever can be defined as a preprocessor constant to improve readability.
Comments bubble
With and without block, both is possible.

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