Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!haven!vrdxhq!daitc!bms-at!stuart From: stuart@bms-at.UUCP (Stuart Gathman) Newsgroups: comp.lang.c Subject: Re: new do-while syntax Summary: needful, but break does the same thing. . . Message-ID: <139@bms-at.UUCP> Date: 22 Dec 88 02:46:03 GMT References: <3049@arcturus> <864@calvin.EE.CORNELL.EDU> <1716@buengc.BU.EDU> <8562@alice.UUCP> Organization: Business Management Systems, Inc., Fairfax, VA Lines: 42 In article <8562@alice.UUCP>, ark@alice.UUCP (Andrew Koenig) writes: > int i, status, count = 0; > char temp[THINGSIZE]; > do { > readthing(precious); > ++count; > for (i = 0; i < THINGSIZE; i++) > temp[i] = precious[i]; > status = munge(temp); > } while (status) { > for (i = 0; i < THINGSIZE; i++) { > if (temp[i] != precious[i]) > printf ("munge changed element %d of line %d\n", > i, count); > } > } This is a necessary contruct. In a structured assembler language I developed, it goes like this: LOOP REPEAT statements statements WHILE WHEN or UNTIL WHEN statements statements THEN cond THEN cond The WHILE part was executed first. *Any* condition could contain a 'WHEN' clause. (As in 'IF (A,LT,B),OR,WHEN . . .') A generalized WHEN construct would be welcome in 'C'. The specific case being discussed, however, is handled quite well by the break statement in standard 'C'! for (;;) { c = getchar(); if (c == EOF) break; process(c); } -- Stuart D. Gathman <..!{vrdxhq|daitc}!bms-at!stuart>