![]() |
![]() |
#141 | |
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,863
|
Yes, I know. I was having a dig at people who insist BASIC is bad because it has GOTO, while forgetting that purportedly superior 'structured' languages also have it.
Goto Quote:
|
|
![]() |
![]() |
#142 |
cheeky scoundrel
Join Date: Nov 2004
Location: Spijkenisse/Netherlands
Age: 43
Posts: 7,124
|
I tend to be on the side of the opinion that does not assume people will walk into clearly visible bear traps. They have functioning brains and eyes.
Yes goto is a sketchy language feature. So is pointer arithmetics. So is an old style switch statement with automatic fallthrough. So are singletons. So are global variables. Etc. Etc. They are still power tools in the right circumstances. |
![]() |
![]() |
#143 |
Registered User
Join Date: May 2023
Location: Norwich
Posts: 531
|
Goto in C isn't the same beast as goto in BASIC though. For one, you have to have labels for the destination, so it's easier to reason about (sure you can still write spaghetti, but you can regardless of whether you use goto).
The problem in BASIC was that goto could take you to absolutely any line, sometimes even a line number based on an arbitrary calculation. Plus it was often the only form of flow control available apart from subroutines. Now it was certainly possible, with discipline, to maintain a good structure but the whole deal with BASIC coding was it was accessible to people who didn't have that discipline. And thus a lot of BASIC programs rapidly descended into impossible to follow flows that were all over the place. |
![]() |
![]() |
#144 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 48
Posts: 3,975
|
Exactly. Old school goto was like jumps and branches in assembly language. Takes effort not to make a mess in and is certainly not great for beginners because of it.
|
![]() |
![]() |
#145 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,419
|
To be fair, it's only the early variants of BASIC that use line numbers and can do that. Anything remotely modern (as in, anything from the past 30 years or so) will require labels to execute a Goto as well.
|
![]() |
![]() |
#146 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,963
|
Not only C, goto is still valid C++ even. It checks the branch isn't skipping over the initialisation of anything that might then be used inappropriately when you compile it, which is about as safe as you can reasonably get. One place where goto crops up a fair amount is in machine generated code.
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trying to find variant of this song | Flow Res. Kenny | Amiga scene | 1 | 11 August 2023 21:58 |
A1200 case, desktop variant? | Malakie | Amiga scene | 6 | 11 December 2021 18:12 |
Preferred Falcon variant | eXeler0 | Retrogaming General Discussion | 19 | 20 November 2020 00:40 |
How to specify the game variant used in Arcade Mode? | ketschak | support.FS-UAE | 2 | 07 March 2014 14:31 |
|
|