473,779 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

go_to what's in using them

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
In article <AM************ ********@bt.com >,
Richard Heathfield <in*****@invali d.invalidwrote:
>I keep hearing about not to use 'go_to' in your code. However, I don't
know what's the reasoning behind it?
>There isn't any reason not to use go_to in your code.
Likewise, there isn't any reason not to use to_go in your code, but
using togo results in undefined behaviour.

-- Richard
--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Nov 10 '06 #11
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
Nov 10 '06 #12
In article <ej**********@c anopus.cc.umani toba.ca>,
Walter Roberson <ro******@ibd.n rc-cnrc.gc.cawrote :
>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.
No doubt Ed's charitable nature led him to replace Wirth's absurd
view with a more reasonable one.
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
The while and repeat constructs can always be replaced by if and goto,
yet remarkably few languages have removed them. Of all the arguments
against goto, this is the most wirthless.

-- Richard
--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Nov 10 '06 #13
av
On Fri, 10 Nov 2006 09:37:47 +0000, Chris Dollin wrote:
>ma****@gmail.c om wrote:
>I keep hearing about not to use 'go_to' in your code. However, I don't
know what's the reasoning behind it?

`goto`, not `go_to`.

Roughly: using goto means that the structure of your code needs
to be unscrambled by connecting the gotos (the goestos?) to the
correspondin g label. This is tedious and prone to error when the
code changes [1]. /Usually/, the syntactically obvious control
bla, bla, bla
you and all ng is wrong on "goto"
because you all seems don't know how that instruction (and labels)
have to appear in the page (or in the screen).

in the first it was "goto" instruction :)
Nov 11 '06 #14

av wrote:
On Fri, 10 Nov 2006 09:37:47 +0000, Chris Dollin wrote:
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?
`goto`, not `go_to`.

Roughly: using goto means that the structure of your code needs
to be unscrambled by connecting the gotos (the goestos?) to the
corresponding label. This is tedious and prone to error when the
code changes [1]. /Usually/, the syntactically obvious control

bla, bla, bla
you and all ng is wrong on "goto"
because you all seems don't know how that instruction (and labels)
have to appear in the page (or in the screen).
Huh? Not everyone reading the newsgroup thinks that goto
is horrible. Several people have alluded to that in this thread.
Many people think it's a pointless religious war.

As to your point that having the label on screen makes
code readable, consider:

int
main(void)
{

int x; x = 1; goto a; a:x -= 5; b:goto e; c:x += 4;
d:goto h; e:x -= 3; f:goto c; g:x *= 2; h:goto i;
i:x -= 1; printf("%d\n", x); return 0; goto g;
goto g; goto f; goto b; goto d;

}

Nov 11 '06 #15
av
On 11 Nov 2006 02:31:51 -0800, Bill Pursell wrote:
>av wrote:
>On Fri, 10 Nov 2006 09:37:47 +0000, Chris Dollin wrote:
>ma****@gmail.c om wrote:

I keep hearing about not to use 'go_to' in your code. However, I don't
know what's the reasoning behind it?

`goto`, not `go_to`.

Roughly: using goto means that the structure of your code needs
to be unscrambled by connecting the gotos (the goestos?) to the
correspondin g label. This is tedious and prone to error when the
code changes [1]. /Usually/, the syntactically obvious control

bla, bla, bla
you and all ng is wrong on "goto"
because you all seems don't know how that instruction (and labels)
have to appear in the page (or in the screen).

Huh? Not everyone reading the newsgroup thinks that goto
is horrible. Several people have alluded to that in this thread.
Many people think it's a pointless religious war.

As to your point that having the label on screen makes
code readable, consider:

int
main(void)
{

int x; x = 1; goto a; a:x -= 5; b:goto e; c:x += 4;
d:goto h; e:x -= 3; f:goto c; g:x *= 2; h:goto i;
i:x -= 1; printf("%d\n", x); return 0; goto g;
goto g; goto f; goto b; goto d;

}
the above is the classical example on how not to use goto

if you understand me,
and you want i have some difficulties just post some c code
that not use goto and claim that solution is the best possible
and no goto can make better that code

possobily i rewrite that code better with only(no if, while, for)
use of goto
Nov 11 '06 #16
av said:

<snip>
>
if you understand me,
Alas, no. Sorry.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: normal service will be restored as soon as possible. Please do not
adjust your email clients.
Nov 11 '06 #17
av wrote:
On 11 Nov 2006 02:31:51 -0800, Bill Pursell wrote:
av wrote:
On Fri, 10 Nov 2006 09:37:47 +0000, Chris Dollin wrote:
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?

`goto`, not `go_to`.

Roughly: using goto means that the structure of your code needs
to be unscrambled by connecting the gotos (the goestos?) to the
corresponding label. This is tedious and prone to error when the
code changes [1]. /Usually/, the syntactically obvious control

bla, bla, bla
you and all ng is wrong on "goto"
because you all seems don't know how that instruction (and labels)
have to appear in the page (or in the screen).
Huh? Not everyone reading the newsgroup thinks that goto
is horrible. Several people have alluded to that in this thread.
Many people think it's a pointless religious war.

As to your point that having the label on screen makes
code readable, consider:

int
main(void)
{

int x; x = 1; goto a; a:x -= 5; b:goto e; c:x += 4;
d:goto h; e:x -= 3; f:goto c; g:x *= 2; h:goto i;
i:x -= 1; printf("%d\n", x); return 0; goto g;
goto g; goto f; goto b; goto d;

}

the above is the classical example on how not to use goto

if you understand me,
and you want i have some difficulties just post some c code
that not use goto and claim that solution is the best possible
and no goto can make better that code

possobily i rewrite that code better with only(no if, while, for)
use of goto
And very likely, your rewrite of that code would also be a classical
example on how not to use goto.

Nov 11 '06 #18
av
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 :)
Nov 13 '06 #19
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.co m <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...

Nov 13 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

54
6576
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...
92
6542
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
137
7185
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,...
125
14850
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
121
10177
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...
9
2221
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...
13
5058
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
669
26218
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
8
2009
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...
0
9633
marktang
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...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10305
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10137
jinu1996
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...
1
10074
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,...
0
9928
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6724
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();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.