[sr-dev] how to define an infinite while loop?

Andrei Pelinescu-Onciul andrei at iptel.org
Fri Apr 2 10:57:11 CEST 2010


On Apr 01, 2010 at 22:27, Alex Balashov <abalashov at evaristesys.com> wrote:
> On 04/01/2010 10:23 PM, Ovidiu Sas wrote:
> 
> >How can I define a simple infinite loop without getting a warning in the 
> >logs.
> 
> How does
> 
>    while(1 == 1)
> 
> stack up?

It wouldn't work, is optimised away to while(1) and you should get the
same warning. Not even starting without optimisations (-O 0) would help,
 since the check is for a constant expression.
The lowest overhead would be $var(x)=1; while($var(x)) {...}.

Andrei



More information about the sr-dev mailing list