Another "D" idea (Oh no, not again!)

Richard Harter g-rh at cca.CCA.COM
Sun Mar 20 04:24:32 AEST 1988


In article <316 at wsccs.UUCP> val at wsccs.UUCP (Val Kartchner) writes:

	... suggesting a break n construct to escape n levels up.

Some languages have this.  It doesn't really work very well.  The
problem is that it is a maintenance nightmare.  If you have deeply
nested code (and that is where this thing would be used) and you
change an intermediate level of nesting you also have to change all
of those lower level 'break n's.  Moreover it can be, shall we say,
obscure as to where that 'break 5' is returning control to.

I am inclined to believe that labelled escapes are somewhat better.
We have already gone over this one, and several people with large
clubs have convinced me that it is not worth bothering with.

The situation boils down to this:  There is no good way in block
structure code to deal with multi-level escapes.  It appears to be
a fundamental property of block structured code.

There is only one real cure:  Don't write deeply nested code that
needs multi-level escapes.

-- 

In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die.
	Richard Harter, SMDS  Inc.



More information about the Comp.lang.c mailing list