Oh nooo! (gotos)
John Hascall
hascall at atanasoff.cs.iastate.edu
Fri Sep 8 00:23:35 AEST 1989
In article <12793 at pur-ee.UUCP> lewie at ecn-ee.UUCP writes:
}[Dave Jones offers an example of what he thinks is a valid use of goto]:
[using goto to get out of a nested control structure]
}I'm sure this comes up often enough, but the reason I'd say there's nothing
}wrong with this type of goto is that it is the equivalent of a continue
}with a label, i.e.:
}while foo (...) {
} while (...) {
} ...
} continue foo;
} ...
} }
}}
I have often wished for something similar, my thoughts have tended toward
the synatx:
continue [constant-integer-expression];
break [constant-integer-expression];
where the [optional] expression indicated how many nested structures
to continue or break, with the default being 1 (just like the current
"continue" and "break").
While we are on the subject of loops, how do people feel about the
practice of using #define to "extend" the language? For example:
#define loop for (;;)
#define exitloop break
loop {
foo();
if (bar()) exitloop;
}
John Hascall
More information about the Comp.lang.c
mailing list