Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 (Fortune 01.1b1); site graffiti.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!ut-sally!ut-ngp!shell!graffiti!peter From: peter@graffiti.UUCP (Peter da Silva) Newsgroups: net.lang.c Subject: Re: "C" wish list. Message-ID: <382@graffiti.UUCP> Date: Fri, 1-Nov-85 21:14:15 EST Article-I.D.: graffiti.382 Posted: Fri Nov 1 21:14:15 1985 Date-Received: Sun, 3-Nov-85 16:27:12 EST References: <335@graffiti.UUCP> <9500028@iuvax.UUCP> Organization: The Power Elite, Houston, TX Lines: 44 > 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