[splint-discuss] Buffer checking and loops

David N. Jansen D.Jansen at cs.ru.nl
Thu Jun 4 05:29:46 PDT 2009


Op 4-jun-2009, om 14:04 heeft Hollas Boris (CR/AEY1) het volgende  
geschreven:

> - On the other hand, splint reports "Passed storage a not  
> completely defined (*a is undefined)" if I replace the for loop by  
> an equivalent while loop:
>   i=0;
>   while(i<3) {
>     a[i] = i;
>     i++;
>   }
>
>   Are for and while loops treated differently or are for loops just  
> easier to analyze for splint?

I had similar problems with while loops that I knew would be executed  
at least once; however, splint still seemed to think that they could  
be executed 0 times. The report disappeared when I replaced the while  
loop by a do ... while loop.
(In one or two cases, I also found differences in splint reports  
between a for and an equivalent while loop, but I can't remember  
exactly where and how.)

David N. Jansen,
Radboud Universiteit Nijmegen


More information about the splint-discuss mailing list