goto命令有什么问题? [英] what is wrong with the goto command?

查看:82
本文介绍了goto命令有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁能告诉我goto命令有什么问题。我注意到它是一个

的那些从不使用过的。


我能理解它可能会导致令人困惑的代码,但我经常使用它像

这个:


这个错了?????


功能x

选择case z

case 1

goto one

case 2

goto two

case else

转到三个

结束选择

exitFunction:

退出功能

一:

.....

转到exitFunction

二:

....... ..........

转到exitFunction

三:

............ ....

转到exitFunction

结束功能

---

请立即告诉我们(通过电话或回复邮件)如果(a)这封电子邮件

包含病毒

(b)您不是预定的收件人

(c)你认为这封电子邮件是垃圾邮件。

我们已尽最大努力确保

以上都不是appl icable。谢谢

由AVG反病毒系统检查( http:// www .grisoft.com)

版本:6.0.698 /病毒库:455 - 发布日期:02/06/2004

Can anyone tell me what is wrong with the goto command. I noticed it is one
of those NEVER USE.

I can understand that it may lead to confusing code, but I often use it like
this:

is this wrong?????

Function x
select case z
case 1
goto one
case 2
goto two
case else
goto three
end select
exitFunction:
exit funtion
one:
.....
goto exitFunction
two:
.................
goto exitFunction
three:
................
goto exitFunction
end function
---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 02/06/2004

推荐答案

WindAndWaves写道:
WindAndWaves wrote:
任何人都可以告诉我goto命令有什么问题。我注意到它是那些永远不会使用的一个。

我可以理解它可能会导致令人困惑的代码,但我经常使用它像
这样:
<这是错误的?????

功能x
选择案例z
案例1
转到一个
案例2
转到两个
案例其他
转到三个
结束选择
exitFunction:
退出功能一个:
..... 转到exitFunction
二:
.................
转到exitFunction
三:
.... ............
goto exitFunction
结束函数
Can anyone tell me what is wrong with the goto command. I noticed it is one
of those NEVER USE.

I can understand that it may lead to confusing code, but I often use it like
this:

is this wrong?????

Function x
select case z
case 1
goto one
case 2
goto two
case else
goto three
end select
exitFunction:
exit funtion
one:
.....
goto exitFunction
two:
.................
goto exitFunction
three:
................
goto exitFunction
end function




我在一个丑陋的系统理论下操作作品比

a漂亮的系统更好。如果它适合你并且你很开心,那就继续吧。


话虽这么说,如果我雇用那样编码的人我会

给他/她一个警告,第二次我看到他/她的代码如

我会解雇那个人。


另外,如果我进入被解雇的人后面,我最多可能会更新代码,除非它是系统的无关紧要部分或

将花费太多时间来纠正这些好处。


但它没有任何问题......如果你在谈论

过程本身正在工作。


我认为这表明缺乏自豪感。它表明你不在乎。它显示了

你是一个特立独行的人,而不是团队合作者。它显示你喜欢意大利面,

更好,你的衬衫,裤子和

地板上有很多番茄渍。其他研究你的代码的程序员会想知道你是如何获得这份工作的。很可能你的同事程序员会嘲笑你背后

你的背部和你的编码风格会提醒他们电影好,

The Bad,The Ugly。


但它有效。如果您的申请无关紧要,请使用它。


只是我的



I operate under the theory that an ugly system that works is better than
a pretty system that doesn''t. If it works for you and you are happy as
a clam, then go ahead.

That being said, if I were to hire someone that coded that way I would
give him/her one warning and the second time I saw him/her code like
that I would fire that person.

Also, if I were to come in behind the person that got fired I would most
likely update the code unless it was an irrelevent part of the system or
would take too much time to correct in regards to the benefits.

But there is nothing wrong with it...if you are talking about the
process itself working.

I think it shows a lack of pride. It shows you don''t care. It shows
you are a maverick, not a team player. It shows you like spaghetti, the
messier the better, lots of tomato stains on your shirt, pants, and the
floor. Other programmers that study your code will wonder how you got
the job. Most likely your coworker programmers will laugh at you behind
your back and your coding style will remind them of the movie The Good,
The Bad, The Ugly.

But it works. If your application is of no consequence, use it.

Just my


.02

.02


亲爱的凯撒沙拉


你让我发笑。但是你从来没有真正告诉我它有什么问题。


在我的例子中,在我看来,我使代码更容易,而不是更难

通过将其分解成部分来理解。你阅读了主要代码来获得

的要点,如果你有兴趣,那么你可以查看

个别子程序。这些子程序中的一些可能会很长并且会阻碍它们吗?


我的意思是,你怎么写一个像我放的那样的函数下面???


我绝对是一个特立独行的人,但这不一定是坏事(我希望b $ b b)。在新西兰,我们喜欢以自己的方式做事。


感谢您的回复


Nicolaas



" Salad" < oi*@vinegar.com>在留言中写道

新闻:j5 ******************* @ newsread1.news.pas.eart hlink.net ...
Dear Caesar Salad

You made me laugh. But you never really told me what is wrong with it.

In my example, it seems to me that I make the code easier, not harder to
understand, by breaking it up into parts. You read the main code to get the
gist of things and if you are interested then you can check on the
individual sub-routines. Some of these sub-routines may be lengthy and
would get in the way?

I mean, how would you write a function like the one I put below???

I definitely am a maverick, but that is not necessarily a bad thing (I
hope). Here in NZ we like to do things our own way.

Thanks for your reply

Nicolaas


"Salad" <oi*@vinegar.com> wrote in message
news:j5*******************@newsread1.news.pas.eart hlink.net...
WindAndWaves写道:
WindAndWaves wrote:
任何人都可以告诉我goto命令有什么问题。我注意到它是
其中一个永远不会使用。

我可以理解它可能导致令人困惑的代码,但我经常使用它这样的

<这是错误的?????

功能x
选择案例z
案例1
转到一个
案例2
转到两个
案例其他
转到三个
结束选择
exitFunction:
退出功能一个:
..... 转到exitFunction
二:
.................
转到exitFunction
三:
.... ............
goto exitFunction
结束函数
Can anyone tell me what is wrong with the goto command. I noticed it is one of those NEVER USE.

I can understand that it may lead to confusing code, but I often use it like this:

is this wrong?????

Function x
select case z
case 1
goto one
case 2
goto two
case else
goto three
end select
exitFunction:
exit funtion
one:
.....
goto exitFunction
two:
.................
goto exitFunction
three:
................
goto exitFunction
end function



我的理论是,一个有效的丑陋系统比
一个漂亮的系统,不是。如果它适合你并且你很高兴作为一个蛤蜊​​,那就继续吧。

那就是说,如果我雇用那样编码的人我会给予它他/她的一个警告,第二次我看到他/她的代码就像我要解雇那个人一样。

另外,如果我要进来后被解雇的人我最有可能更新代码,除非它是系统的无关紧要部分或
需要花费太多时间来纠正这些好处。

但是没有错如果你正在谈论
过程本身的工作。

我认为这表明缺乏自豪感。它表明你不在乎。它表明你是一个特立独行的人,而不是团队合作者。它表明你喜欢意大利面条,味道越来越好,衬衫,裤子和地板上有很多番茄渍。其他研究你的代码的程序员会想知道你是如何得到这份工作的。很可能你的同事程序员会在你的背后嘲笑你,你的编码风格会让他们想起电影The Good,
The Bad,The Ugly。

但是它有效。如果您的申请无关紧要,请使用它。

只是我的



I operate under the theory that an ugly system that works is better than
a pretty system that doesn''t. If it works for you and you are happy as
a clam, then go ahead.

That being said, if I were to hire someone that coded that way I would
give him/her one warning and the second time I saw him/her code like
that I would fire that person.

Also, if I were to come in behind the person that got fired I would most
likely update the code unless it was an irrelevent part of the system or
would take too much time to correct in regards to the benefits.

But there is nothing wrong with it...if you are talking about the
process itself working.

I think it shows a lack of pride. It shows you don''t care. It shows
you are a maverick, not a team player. It shows you like spaghetti, the
messier the better, lots of tomato stains on your shirt, pants, and the
floor. Other programmers that study your code will wonder how you got
the job. Most likely your coworker programmers will laugh at you behind
your back and your coding style will remind them of the movie The Good,
The Bad, The Ugly.

But it works. If your application is of no consequence, use it.

Just my


这篇关于goto命令有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆