Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!bellcore!texbell!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: new do-while syntax Message-ID: <2507@ficc.uu.net> Date: 20 Dec 88 15:43:09 GMT References: <3049@arcturus> <864@calvin.EE.CORNELL.EDU> <1716@buengc.BU.EDU> <8562@alice.UUCP> Organization: SCADA Lines: 33 In article <8562@alice.UUCP>, ark@alice.UUCP (Andrew Koenig) writes: > As I said before, it's way too late to get anything like this > into C now. It's fun to think about, though. Is it? Petition your compiler writer. It should be a completely safe and transparent extension to the existing syntax. The following should all be valid: do ... while(x); /* existing do/while, null while expr */ while(x) ... /* existing while, null do expr */ do ... while(x) ... /* full do/while */ The yaccoid BNF would be (since ";" is a valid statement): dowhile : do WHILE(expr) statement ; do : /* nothing */ | DO statement ; If you can get a few compiler writers to put this in, it'll have a chance of making it to the next version of 'C'. It reduces the complexity of the language, too... replaces three constructs (do, while, and for) with one. (yes, I am aware of the 'continue' problem, and I'm not suggesting removing the for statement). In fact, this could be declared an "editorial change" if you have the brass. -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net.