4 ms·
Neat, it has an example of the kind of thing Dijkstra was talking about when he wrote Go To Statement Considered Harmful. main( ) { auto c; read:
by monocasa 6y ago
Neat, it has an example of the kind of thing Dijkstra was talking about when he wrote Go To Statement Considered Harmful.
main( ) {
auto c;
read:
c= getchar();
putchar(c);
if(c != '*n') goto read;
} /* loop if not a newline */
People forget the world of ubiquitous goto enabled control flow with languages like this and Dartmouth BASIC.
- smhenderson 6y agoBut even then, in this tutorial, you can see that it was already considered something to try and avoid: (Good programming practice dictates using few labels, so later examples will strive to get rid of them.) and then later... The ability to replace single statements by complex ones at will is one thing that makes B much more pleasant to use than Fortran. Logic which requires several GOTO's and labels in Fortran can be done in a simple clear natural way using the compound statements of B.