Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site rochester.UUCP Path: utzoo!linus!decvax!harpo!seismo!rochester!stuart From: stuart@rochester.UUCP (Stuart Friedberg) Newsgroups: net.lang.c Subject: Labelled breaks and continues Message-ID: <2693@rochester.UUCP> Date: Thu, 25-Aug-83 00:32:04 EDT Article-I.D.: rocheste.2693 Posted: Thu Aug 25 00:32:04 1983 Date-Received: Fri, 26-Aug-83 05:32:51 EDT Sender: stuart@rocheste.UUCP Organization: U. of Rochester, CS Dept. Lines: 30 From: Stuart Friedberg I disagree with chongo about the 'cleanness" of labelled break and continues, so long as they only go to the end or beginning of enclosing blocks. That means they are *not* as general as gotos. >From the 'theoretical' standpoint it has been shown that labelled break and continues are strictly more expressive than the original constructs for "structured programming", the conditional and the loop (while and/or repeat). You get this additional expressive power *without* generating any irreducible flowgraphs, which correspond to gotos into a loop or straightline code block. Reference is "A Comparison of Multilevel Break and Next Statements", Brenda S. Baker & S. Rao Kosaraju, Journal of the Association for Computing Machinery, Volume 26, Number 3, July 1979, pp 555-566. They are *very* easy to implement. I did a compiler for a language using them (BABBAGE) for a course last year. (No, this is not the same Babbage as was written up in Datamation last year!) You know immediately upon seeing the break or continue whether or not it references a legal label or not. You can even do the forward references (for breaks) in one pass. I find them an extremely handy thing to have around. They take care of just about any exceptional conditions that you might reasonably use a goto for, without the uncontrollable character of the goto. Stu Friedberg {seismo, allegra}!rochester!stuart stuart@rochester