I keep hearing about not to use 'go_to' in your code. However, I don't
know what's the reasoning behind it?
Can any one here shed some light?
Thanks in advance,
Manish
Nov 9 '06
23 1790
On 13 Nov 2006 04:01:50 -0800, santosh wrote:
>av wrote:
>On Thu, 9 Nov 2006 19:11:22 +0000 (UTC), Walter Roberson wrote:
>In article <11************ **********@h48g 2000cwc.googleg roups.com>, ma****@gmail.c om <ma****@gmail.c omwrote: I keep hearing about not to use 'go_to' in your code. However, I don't know what's the reasoning behind it?
Can any one here shed some light?
You may wish to search out the famous article, "Go To Statement Considered Harmful" by Dijkstra.
"while, for, ifs Statements Considered Harmful" by me :)
Are you 'ab' of alt.lang.asm? If so, seemingly, you don't like traditional assembler nor do you like C! Maybe you should start a group for your private language, tons of whose source you regularly spam a.l.a with...
tons of tons ma****@gmail.co m wrote:
I keep hearing about not to use 'go_to' in your code. However, I don't
know what's the reasoning behind it?
Can any one here shed some light?
Thanks in advance,
Manish
Undisciplined use of goto (not go_to) can result in code that is
difficult to read and maintain. It can also inhibit certain compiler
optimizations, at least according to one of my references.
The main problem is that since a goto can branch either direction in a
function, it's possible to write code that doesn't "read" in a linear
fashion, making the code difficult to debug by inspection. It can also
lead to code that's "brittle", or difficult to modify. I saw one
abomination that had 13 or so gotos branching in random directions; it
literally took weeks to puzzle out the flow of control (granted, this
code had other problems, but the gotos made a bad situation
impossible).
There are times when a goto is useful, such as for breaking out of a
deeply nested loop, but more often than not it's better to stick with
the standard control structures (if, while, for, do) and unconditional
branch statements (break and continue). ma****@gmail.co m wrote:
I keep hearing about not to use 'go_to' in your code. However, I don't
know what's the reasoning behind it?
Can any one here shed some light?
See C FAQ 17.10
--
Tor <torust AT online DOT no>
Walter Roberson wrote:
In article <11************ **********@i42g 2000cwa.googleg roups.com>,
Ed Prochak <ed*******@gmai l.comwrote:
However even Wirth did not propose complete elimination of GOTO. Wirth
created PASCAL and still included GOTO. His chief use of GOTO was error
handling. The goal of the Structured Programming movement is often
mistakenly described as seaking GOTOless programming. Such a
description is wrong. It was the UNRESTRAINED use of goto that they
sought to eliminate.
Your analysis disagrees with Wirth's own published works.
http://www.swissdelphicenter.ch/en/niklauswirth.php
Yet, Pascal also suffered from certain deficiencies, more or
less significant depending on personal perception and
application. [...]
Certain other deficiencies were due to the author's lack of
courage to throw some rules inherited from Algol over board, in
fear of antagonizing influential Algol programmers. The prime
entry in this list is the famed go to statement, retained
although, in principle, always replaceable by an if, while, or
repeat construct
--
Prototypes are supertypes of their clones. -- maplesoft
Interesting. I alway thought he was not of that radical camp. I based
my judgement on his textbook: Algorithms+Data Structures=Prog rams
I remember at least one of the programs in the book used goto. And
while goto is "in principle, always replaceable by an if, while, or
repeat construct", without an error handling mechanism (like EXCEPTION)
in the language, goto can be very useful. Otherwise the nesting of
error checking IF statements gets tedious and nearly as error prone as
the goto.
Ed This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brandon J. Van Every |
last post by:
I'm realizing I didn't frame my question well.
What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump
up in your chair and scream "Wow! Ruby has *that*? That is SO FRICKIN'
COOL!!! ***MAN*** that would save me a buttload of work and make my life
sooooo much easier!"
As opposed to minor differences of this feature here, that feature there.
Variations on style are of no interest to me. I'm coming at this from a...
|
by: Reed L. O'Brien |
last post by:
I see rotor was removed for 2.4 and the docs say use an AES module
provided separately... Is there a standard module that works alike or
an AES module that works alike but with better encryption?
cheers,
reed
|
by: Philippe C. Martin |
last post by:
I apologize in advance for launching this post but I might get enlightment
somehow (PS: I am _very_ agnostic ;-).
- 1) I do not consider my intelligence/education above average
- 2) I am very pragmatic
- 3) I usually move forward when I get the gut feeling I am correct
- 4) Most likely because of 1), I usually do not manage to fully explain 3)
when it comes true.
- 5) I have developed for many years (>18) in many different environments,...
|
by: Sarah Tanembaum |
last post by:
Beside its an opensource and supported by community, what's the fundamental
differences between PostgreSQL and those high-price commercial database (and
some are bloated such as Oracle) from software giant such as Microsoft SQL
Server, Oracle, and Sybase?
Is PostgreSQL reliable enough to be used for high-end commercial
application? Thanks
|
by: typingcat |
last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so
on. I've tried many PHP IDEs today, but almost non of them supported
Unicode (UTF-8) file.
I've found that the only Unicode support IDEs are DreamWeaver 8 and
Zend PHP Studio.
DreamWeaver provides full support for Unicode. However, DreamWeaver is
a web editor rather than a PHP IDE. It only supports basic IntelliSense
(or code completion) and doesn't have anything...
| |
by: Patty O'Dors |
last post by:
Hi
Can somebody please tell me what namespaces are actually for?
I notice that when I start a new project in C#, it puts everything in a
namespace of the same name as the project.
I found them a bit annoying as when I save a class's .cs file to my 'generic
code' folder, and then put it in another project, I have to manually go and
change the namespace name. This I find a bit of a PITA.
I used VB.NET for a bit and found it didn't have...
|
by: Jason Huang |
last post by:
Hi,
Would someone explain the following coding more detail for me? What's the
( ) for?
CurrentText = (TextBox)e.Item.Cells.Controls;
Thanks.
Jason
|
by: Xah Lee |
last post by:
in March, i posted a essay “What is Expressiveness in a Computer
Language”, archived at:
http://xahlee.org/perl-python/what_is_expresiveness.html
I was informed then that there is a academic paper written on this
subject.
On the Expressive Power of Programming Languages, by Matthias
Felleisen, 1990.
http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
|
by: clintonG |
last post by:
Every single time neophytes or converts ask about naming and style
conventions what are they told by the majority consensus? The answer is "do
what you prefer but do so consistently" right? Yes, that's right, that's
exactly what is said. People joining a team of developers are also
encouraged to cooperate with their peers and adopt what has already been
established right? Yes, that's exactly what is encouraged.
Teamwork and cooperation...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |