Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

GOTO

Name: Anonymous 2007-01-29 2:03

My C++ professor stated that it is taboo if you use the GOTO statement in code. Tell me /prog/, is GOTO as bad as he says? What's your opinion on it?

Name: Anonymous 2007-01-30 15:12

>>15
break is the poor man's goto. You still have to find where it will take you, and you don't even have the label to search for. And good luck figuring out where an exception will dump you in your average C++ mess.

>>19
I can write any piece of code without using a single function. Doesn't mean I should. If using a language tool will help readability, it should be used. And layers upon layers of nested blocks is not very readable, nor is the same error handling code copy pasted 100 times.

Gotos aren't used only because they're so easy to abuse. But anything in a language can be abused. Thus, think about what you're writing, and use gotos if it makes sense. Blind adherence to rules without thinking about the reason behind them is never good.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List