Re:GOTOphobia Considered Harmful (In C)
by j16sdiz on Sunday February 26, 2023 @11:00PM
(#34952804)
Now imagine you have got a typo:
This would be almost impossible to debug.
[ Parent
| on HN ]
Re:GOTOphobia Considered Harmful (In C)
by thaumasiotes on Monday February 27, 2023 @04:06AM
(#34954454)
That would correspond to the following C:
/* 280 */
do_something();
for (;;) {
/* 290 */
/* display chart in blocks of 18 lines */
/* 400 */
L = 0;
}
when the correct code is this: for (;;) {
/* 280 */
do_something();
/* 290 */
/* display chart in blocks of 18 lines */
/* 400 */
L = 0;
}
The bug is that the call to do_something() precedes the outer loop when it should be inside the loop.Is that easier to debug in C than it is in the BASIC program? What's the difference?