Path: utzoo!attcan!uunet!husc6!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: new do-while syntax Message-ID: <1759@buengc.BU.EDU> Date: 22 Dec 88 17:24:21 GMT References: <3049@arcturus> <864@calvin.EE.CORNELL.EDU> <1716@buengc.BU.EDU> <1963@scolex> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 44 In article <1963@scolex> seanf@sco.COM (Sean Fagan) writes: >In article <1716@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes: [in response to:] >>>>In article <8536@alice.UUCP>, ark@alice.UUCP (Andrew Koenig) writes: >>But what's wrong with [the following code]? >> do { >> process(ch); >> process2(ch); >> process3(ch); >> } while ( >> ch = getchar(), >> ch &= MASK, >> ch = table_look_up[ch], >> report_status(ch), >> ch != EOF >> ); > >Uhm, little thinks like the fact that quite a few compilers will generate >the equivalent of: [...broken code deleted...] Buy yerself a new compiler. This one's screwed. [...optimization of broken code deleted quickly...] >Also, ch is not initialized to the getchar(), which it was in the initial >example (which I deleted, of course), and the code looks horrible. I happen to think it looks just fine; the usage of "(" and ");" parallels the usage of "{" and "}", and the comma is akin to a sort of sub-semicolon. (Will the Semanticists please put away those rotten vegetables? Thank you.) It Just Ain't C. >Is that enough? No, you forgot to impugn my ancestry. And to mention that statement is not expression, expression is not statement. The example above is not complete by any means, and will break if I try to put a "for(expr;expr;expr);," in the middle of the while-block. --Blair "...something about..."