Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!gummo!whuxlb!floyd!vax135!ukc!root44!jmc From: jmc@root44.UUCP (John Collins) Newsgroups: net.lang.c Subject: C 'break' command - a query Message-ID: <4144@root44.UUCP> Date: Wed, 17-Aug-83 06:35:56 EDT Article-I.D.: root44.4144 Posted: Wed Aug 17 06:35:56 1983 Date-Received: Sun, 21-Aug-83 23:36:17 EDT Lines: 58 Could some guru acquainted with the history of C tell my why when Dennis Ritchie got hold of BCPL he changed the 'endcase' statement, merging it with 'break'? For those who don't know, BCPL allows 'loop' (equivalent to 'continue' in C), 'break', to get you out of the innermost loop, and 'endcase' to get out of the innermost 'switchon' statement (equivalent to 'switch'). Thus whereas in C you might have to write while (foo) { ..... switch (bar) { case ... ..... goto endloop; case ... .... continue; case ... break; } .... } endloop: in BCPL you could replace this with while foo do { ..... switchon (bar) into { case ... ..... break; case ... .... loop; case ... endcase; } .... } Apart from anything else, there is a aesthetic element, in that 'break' always takes you contextually further than 'loop/continue'. Please note that I am NOT arguing for an automatic jump prior to every new 'case' statement (a horrid idea which some people advocate). If I would like any one thing, it would be to have something like the 'break n' 'continue n' statements of 'sh'. John Collins ...!vax135!ukc!root44!jmc