Named Blocks (Was Re: Oh noooooo!!)
Wm E Davidsen Jr
davidsen at crdos1.crd.ge.COM
Fri Sep 8 01:05:34 AEST 1989
In article <475 at thirdi.UUCP>, peter at thirdi.UUCP (Peter Rowell) writes:
| One thing I would have loved to have seen introduced by ANSI would have
| been "named blocks", but I am sure that parsing them is a bitch.
| Given this "improvement", the above might have been written:
|
| while(rule = (Rule*)Queue_iter_next(&rule_iter)) { "outer loop"
| while(rsym = (Symbol*)Queue_iter_next(&rsym_iter)) { "inner loop"
I think the idea of naming the loop rather than the block, as
suggested earlier, would be easier to parse.
Ex:
while loop1 (a < b) {
while (b = foo(2)) {
/* stuff here */
if (m > 20) continue loop1; /* specifies the scope of the loop */
}
/* this is where 'continue loop1' transfers */
}
Disclamer: this is not my idea, and I am not offering an opinion on
including it in the language. I think discussion of these features is a
good way to have the major pitfalls discovered before someone has
implemented them.
--
bill davidsen (davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon
More information about the Comp.lang.c
mailing list