"C" wish list.

Peter da Silva peter at graffiti.UUCP
Sat Nov 2 12:14:15 AEST 1985


>  With loop-exit statement, the reader is warned explicitly the
> existence of multi-exit ( or break) points inside the loop.

OK, make the following changes to your loop to make it 'C'...

> 
>       i = 0;
	for(;;) {
>         /* WHENEVER WE SEE A LOOP STATEMENT, WE KNOW THERE MAY HAVE
>         -- SEVERAL EXIT POINTS. IT IS NOT AN EASY LOOP. */ 
> 
>         if  (i>=100)
		break;
>         /* NOW YOU DON'T HAVE THE IMPRESSION THAT THE LOOP 
>         -- WILL ALWAYS ITERATE 100 TIMES BECAUSE THERE MAY EXIST
>         -- OTHER EXIT POINTS. */ 
> 
>         checkReturn = function1(x); 
>         if (checkReturn == BAD)
		break;
>         .................  
>         checkReturn = function5(x);
> 	if (checkReturn == BAD)
	{
> 	    result[i] = 0;
	    break;
	}
> 	else
> 	    result[i] = function6(x);
>         i++;
>       }

> This is a style encouraged by Ada or Modula-2 language.
> In existing C language, we may use macro definitions to simulate 
> the loop-exit statement...

...or just use the existing syntax. Why do you need to "simulate"
something that's already there? Remember that "exit" already has
a meaning to 'C' programmers...
-- 
Name: Peter da Silva
Graphic: `-_-'
UUCP: ...!shell!{graffiti,baylor}!peter
IAEF: ...!kitty!baylor!peter



More information about the Comp.lang.c mailing list