Doom-Utils / deutex

WAD composer for Doom, Heretic, Hexen, and Strife
Other
61 stars 17 forks source link

goto statement in deutex.c #36

Closed Voros2 closed 7 years ago

Voros2 commented 7 years ago

In the parse_argv section. Consider removing it.

chungy commented 7 years ago

Why? goto isn't bad.

Voros2 commented 7 years ago

But it's highly discouraged.

chungy commented 7 years ago

goto is discouraged as a crutch and primarily against people that started programming with BASIC, particularly, the early Microsoft BASIC variants found on Commodore 64 and other microcomputers of the early 1980s where there was no function support and programs would become a tangled web to jump to and from different parts. People that learned to program this way sometimes had/have a hard time grasping the concepts of program flow and functions that are available in more powerful languages.

As it is, though, it's only an unconditional jump instruction. It is quite useful in C when needing to break out of many nested loops, especially in error conditions, or in this particular case, to not bother with the rest of the for loop. There's nothing really wrong with using goto where appropriate, and it can make code cleaner rather than messier.