Xref: utzoo comp.lang.c:27727 comp.std.c:2762 Path: utzoo!utgpu!watserv1!watdragon!lion!ccplumb From: ccplumb@lion.waterloo.edu (Colin Plumb) Newsgroups: comp.lang.c,comp.std.c Subject: Re: loops in general Summary: exit-in-the-middle syntax. Keywords: loops Message-ID: <23094@watdragon.waterloo.edu> Date: 10 Apr 90 14:52:24 GMT References: <1565@amethyst.math.arizona.edu> Sender: daemon@watdragon.waterloo.edu Organization: University of Waterloo Lines: 29 Actually, C already has a loop syntax that could be extended to exit-in-the-middle loops. It would be fun to hack this into GCC. I presume the standard would require its usual one diagnostic about the use of extensions and then be silent on the issue. Anyway, C currently has while (expr) stmt and do stmt while (expr); However, ';' is a legal statement, so how about treating these as special cases of [do stmt] while (expr) stmt So I could write a loop like do c = getchar(); while (c != EOF || !feof(stdin)) { } Perl's continue blocks are also nifty, but I don't know of a really elegant way to add them, and goto cont; ... ; continue: ...; works just as well. -- -Colin