Path: utzoo!attcan!uunet!sco!seanf From: seanf@sco.COM (Sean Fagan) Newsgroups: comp.lang.c Subject: Re: new do-while syntax Message-ID: <1963@scolex> Date: 22 Dec 88 02:30:58 GMT References: <3049@arcturus> <864@calvin.EE.CORNELL.EDU> <1716@buengc.BU.EDU> Reply-To: seanf@sco.COM (Sean Fagan) Organization: The Santa Cruz Operation, Inc. Lines: 44 In article <1716@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes: >In article <864@calvin.EE.CORNELL.EDU> johns@calvin.ee.cornell.edu.UUCP (John Sahr) writes: >>>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: do { proces(ch); process2(ch); process3(ch); } while ( getchar(), ch&MASK, table_look_op[ch], report_status(ch), ch != EOF) ; which is all that you're guarenteed (assuming the compiler does no optimizations). Put some optimizations in (assuming ch is non-volatile in a dpANSI compiler, or the compiler assumes it isn't), and you get: getchar(), report_status(ch), ch!=EOF as the conditional for the while. 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. Is that enough? -- Sean Eric Fagan | "Merry Christmas, drive carefully and have some great sex." seanf@sco.UUCP | -- Art Hoppe (408) 458-1422 | Any opinions expressed are my own, not my employers'.