Hi,

Jerry wrote:
> 
> Just a casual browse of the C for plmap reveals this gem:
> 
> for (;;) {some stuff}
> 
> What does that do? Probably loops without end.

1    for (;;) {
2    /* read in # points in segment */
3    if (pdf_rdx(n_buff, sizeof (unsigned char)* 2, in) == 0) break;
4    n = (n_buff[0] << 8) + n_buff[1];
5    if (n == 0) break;
6
7    pdf_rdx(buff, sizeof (unsigned char)*4*n, in);
8    if (n == 1) continue;
9
10        /*  rest of the stuff snipped ...  */ 
11   }


The for statement does mean loop without end, however the loop should be 
terminated by the break statements in lines 3 and 5 above. 

More generally the break statement terminates the execution of the nearest 
enclosing do, for, switch, or while statement in which it appears. Control 
passes to the statement that follows the terminated statement. 

Note the code also uses a continue statement (line 8) which skips to the next 
iteration of the loop.
 
Again more generally the continue statement passes control to the next 
iteration of the nearest enclosing do, for, or while statement in which it 
appears, bypassing any remaining statements in the do, for, or while statement 
body.

Hope this helps


Terrence


      

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to