![]() |
Don't use gotos!! Fair warning
|
I used a few Goto's in my Computing project a few months ago... my teacher went crazy! :p
Thing is, she hadn't told us not to use Goto statements because it's unstructured. Bollocks to that - I know what my program is doing, I know where the Goto's go, and it's not as if anyone else will see it. |
Edsger Dijkstra's 1968 criticism of goto's, in case you're interested:
http://www.acm.org/classics/oct95/ |
I don't goto, man. I just don't.
|
Goto's are fine for some things. Having multiple level breaks in C like in PHP would practically eliminate those things though.
Here's an example with some meaningless code: Code:
for(i = 0; i < 10; i++) |
Or, you could simply put the loops in an inline function and return from it.
All this structure, of course, breaks down to gotos at the machine code level, anyway. Of course, you can write spaghetti code without gotos, too: Code:
unsigned uState=0; |
Mantralord, you are a great wizard, But Wetwired has seemed to outdone you.
CRUCIO MANTRALORD! YOU LET HIM SURPASS YOU AGAIN! |
Quote:
Actually, I've used that structure before too...here's a shitty html parser I wrote some time ago: Code:
void HTMLParser::Parse(std::string code) |
All times are GMT -6. The time now is 02:35 AM. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.