Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site hou4b.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxj!houxm!vax135!ariel!hou4b!mat
From: mat@hou4b.UUCP (Mark Terribile)
Newsgroups: net.lang.c
Subject: Re: hashing external names & other goodies.
Message-ID: <1269@hou4b.UUCP>
Date: Thu, 10-Jan-85 13:15:29 EST
Article-I.D.: hou4b.1269
Posted: Thu Jan 10 13:15:29 1985
Date-Received: Sat, 12-Jan-85 01:10:17 EST
References: <7092@brl-tgr.ARPA>
Organization: AT&T Information Systems Laboratories, Holmdel, NJ
Lines: 57

> -- are break (n) and continue (n) in the ANSI Proposed Standard yet?  (If
> you couldn't guess, the one breaks (n) levels of code structures -- case's,
> while's, etc. -- while the other continues with the n'th enclosing loop.)
> Yes, I recognise the existence of setjmp() and longjmp(), but get queasy at
> the thought of any kind of jump.

I hope these NEVER get in!  This is a great way to write fragile code, and
there is a MUCH more durable way to get what you are trying to get

	Why is it fragile?  Well, it's easy to break it accidentally when
you rework code.

		while( ... )
			switch( ... )
			{
			  case ..:
				... lots of code ...
				break 2;
				... lots more code ...

				break;
			  case ..:
				...
			}

What happens when that ``lots of ... lots more code'' gets surrounded by
another loop or another switch in the course of the program's evolution?

This is a great pitfall for ``the next guy'' who is going to use this code.
This design is only pleasing to sociopaths.

One better way is with (horrors) a label.  Both ADA and (extended) PL/I
do this, and it seems to work pretty well.  The exact forms differ from
language to language, but in C it might take the form of


		while( ... )
		  command_char:
			switch( ... )
			{
			  case ..:
				... lots of code ...
				break command_char;
				... lots more code ...

				break;
			  case ..:
				...
			}

This is now solidly immune to the addition of new levels of control between
the structure to be ``broken'' and the decision to break it.
-- 

	from Mole End			Mark Terribile
		(scrape .. dig )	hou4b!mat
    ,..      .,,       ,,,   ..,***_*.