Editing Talk:292: goto

Jump to: navigation, search
Ambox notice.png Please sign your posts with ~~~~

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 6: Line 6:
 
::Yeah, in most high-level languages exception handeling is preffered to goto. But some lower-level languages like C don't have that construct. Note that exception handling allows to go straight from inside a function to the error-handling code outside the function, which is an advantage over C-style error handling which usually require you to check the return value of every function in case you got a specialized "error code".[[Special:Contributions/141.101.99.228|141.101.99.228]] 19:46, 19 December 2013 (UTC)
 
::Yeah, in most high-level languages exception handeling is preffered to goto. But some lower-level languages like C don't have that construct. Note that exception handling allows to go straight from inside a function to the error-handling code outside the function, which is an advantage over C-style error handling which usually require you to check the return value of every function in case you got a specialized "error code".[[Special:Contributions/141.101.99.228|141.101.99.228]] 19:46, 19 December 2013 (UTC)
 
:::You actually can throw true exceptions in C, but without the syntactic sugar it's tedious (a lot more code), confusing (what the hell does this do?) and error prone (one could easily just wind up going to the start of the try block again, rather then going to the catch block). Also a throws and catch in the same function/method is generally frowned up for the same reasons as GOTO.--[[Special:Contributions/108.162.238.224|108.162.238.224]] 16:48, 27 March 2014 (UTC)
 
:::You actually can throw true exceptions in C, but without the syntactic sugar it's tedious (a lot more code), confusing (what the hell does this do?) and error prone (one could easily just wind up going to the start of the try block again, rather then going to the catch block). Also a throws and catch in the same function/method is generally frowned up for the same reasons as GOTO.--[[Special:Contributions/108.162.238.224|108.162.238.224]] 16:48, 27 March 2014 (UTC)
βˆ’
:I feel like it needs to be explained that GOTO was considered problematic in BASIC or its parent ForTran, because it did not include any ability to return. The alternative was GOSUB, which retained a pointer to your departure, and you could then RETURN to get back to the program flow. They were [[Wikipedia:Imperative programming|imperative]] languages, but not advanced enough to be necessarily [[Wikipedia:Structured programming|structured]] or [[Wikipedia:Procedural programming|procedural]], so GOTO would make debugging extremely complex. This is one of the origins of the term "spaghetti code", because tracing the program path would become necessary to find out what was going wrong, some segment of code being impossible to enter because of GOTOs ending up skipping it under all use cases. The lines of the trace would look like spaghetti. All they needed to do was use GOSUB-RETURN instead. So yes, goto or its equivalent in other languages might be acceptable, but it was highly problematic in BASIC. β€” [[User:Kazvorpal|Kazvorpal]] ([[User talk:Kazvorpal|talk]]) 17:52, 1 November 2019 (UTC)
+
:I feel like it needs to be explained that GOTO was considered problematic in BASIC or its parent ForTran, because it did not include any ability to return. The alternative was GOSUB, which retained a pointer to your departure, and you could then RETURN to get back to the program flow. It was an [[Wikipedia:Imperative programming|imperative]] language, but not advanced enough to be necessarily [[Wikipedia:Structured programming|structured]] or [[Wikipedia:Procedural programming|procedural]], so GOTO would make debugging extremely complex. This is one of the origins of the term "spaghetti code", because tracing the program path would become necessary to find out what was going wrong, some segment of code being impossible to enter because of GOTOs ending up skipping it under all use cases. The lines of the trace would look like spaghetti. All they needed to do was use GOSUB-RETURN instead. So yes, goto or its equivalent in other languages might be acceptable, but it was highly problematic in BASIC. β€” [[User:Kazvorpal|Kazvorpal]] ([[User talk:Kazvorpal|talk]]) 17:52, 1 November 2019 (UTC)
  
 
"Velociraptors are a running joke..." Ha, I get it [[Special:Contributions/79.169.177.15|79.169.177.15]] 13:06, 9 October 2013 (UTC)
 
"Velociraptors are a running joke..." Ha, I get it [[Special:Contributions/79.169.177.15|79.169.177.15]] 13:06, 9 October 2013 (UTC)

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)