[splint-discuss] How to control infinite Loop?

Ken Raeburn raeburn at raeburn.org
Mon Nov 24 02:49:19 PST 2008


On Nov 24, 2008, at 04:28, Le Huu Hoang Gia wrote:
> I write a code:
> void loop1(int x)
> {
> while (x < 3) x--;
> };
> Splint report no errors or warning.
> Is there any way to analize this code? I expected that splint would  
> report a warning in this loop.

After x reaches INT_MIN, you're likely to get INT_MAX or a signal from  
the next decrement, so it wouldn't be an infinite loop in those  
cases.  The details are up to the compiler implementation, though.

Ken


More information about the splint-discuss mailing list