Hi,
I know I know its notoriously bad! I don't want to use it. I was wondering,
does it still exist? If it does, I really don't understand how!? like what
happens if you just goto halfway through a function (no objects properly
constructed!) , or a constructor itself??
Just intrigued!!
Mike 36 6740
* Michael: I know I know its notoriously bad! I don't want to use it. I was wondering, does it still exist?
Yes.
If it does, I really don't understand how!?
Like always.
like what happens if you just goto halfway through a function (no objects properly constructed!) ,
That is forbidden by §6.6.4/3; it won't or shouldn't compile.
or a constructor itself??
?
Just intrigued!!
As you learn more you'll find many more unsafe constructs, in all languages.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Michael wrote: I know I know its notoriously bad!
Long functions are bad. Short ones have no reason to use 'goto', and thus
'goto' is relatively harmless.
I don't want to use it. I was wondering, does it still exist? If it does, I really don't understand how!? like what happens if you just goto halfway through a function (no objects properly constructed!) , or a constructor itself??
Ordinarily, one should not learn C++ laws via "but my compiler likes it".
In this case, a little VC++ experiment is useful:
goto bar;
string foo;
bar:;
error C2362: initialization of 'foo' is skipped by 'goto bar'
The language designers took care of it. With no legacy C constructors to
support, they ordained compilers reject (relatively) non-structured 'goto'
abuses.
--
Phlip http://industrialxp.org/community/bi...UserInterfaces
"Alf P. Steinbach" <al***@start.no > wrote in message
news:42******** ********@news.i ndividual.net.. . * Michael: I know I know its notoriously bad! I don't want to use it. I was
wondering, does it still exist? Yes.
If it does, I really don't understand how!?
Like always.
like what happens if you just goto halfway through a function (no objects properly constructed!) ,
That is forbidden by §6.6.4/3; it won't or shouldn't compile.
so what are the limits on what you can 'goto' 'to' ?
local scope? or a constructor itself?? ?
Just intrigued!!
As you learn more you'll find many more unsafe constructs, in all
languages. -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
* Michael: * Alf P. Steinbach: * Michael: I know I know its notoriously bad! I don't want to use it. I was wondering, does it still exist?
Yes.
If it does, I really don't understand how!?
Like always.
like what happens if you just goto halfway through a function (no objects properly constructed!) ,
That is forbidden by §6.6.4/3; it won't or shouldn't compile. so what are the limits on what you can 'goto' 'to' ? local scope?
Quoting the standard: "It is possible to transfer into a block, but not in a
way that bypasses declarations with initialization. "
Btw., don't quote things you don't reply to or irrelevant to your reply;
snipped further quoting.
Download and install <url: http://home.in.tum.de/~jain/software/oe-quotefix/>.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
"Michael" <sl***********@ hotmail.com> wrote in
news:d1******** **@sparta.btint ernet.com: Hi, I know I know its notoriously bad! I don't want to use it. I was wondering, does it still exist? If it does, I really don't understand how!? like what happens if you just goto halfway through a function (no objects properly constructed!) , or a constructor itself?? Just intrigued!!
Yes goto still exists.
The type of goto you describe is ill-formed. See section 6.7(3) of the
Holy Standard :)
Michael wrote: Hi, I know I know its notoriously bad! I don't want to use it. I was wondering, does it still exist? If it does, I really don't understand how!?
Yes it exists. Assume by "how" you mean "why". goto is extensively used
in machine-produced efficient C++ code.
--
Ioannis Vranos http://www23.brinkster.com/noicys
Ioannis Vranos wrote: Yes it exists. Assume by "how" you mean "why". goto is extensively used in machine-produced efficient C++ code.
Please note Ioannis did not say "goto is efficient". It might be more
efficient than a well-structured function call; it might not.
Under the theory that a function takes time pushing variables onto a stack,
'goto' might generate a single branch opcode. However, that 'goto' might
live in a function that's now long enough to overflow the CPU cache. Several
small functions might have fit in the cache, making their specific function
calls faster.
--
Phlip http://industrialxp.org/community/bi...UserInterfaces
On Thu, 24 Mar 2005 23:53:37 +0000 (UTC), "Michael"
<sl***********@ hotmail.com> wrote: I know I know its notoriously bad! I don't want to use it.
Why not? Goto is very useful since there is not labelled break. When
you have nested for in another for /for example/ the easiest way /and
elegant too/ to break from the external one is to use goto.
have a nice day
bye
--
Maciej "MACiAS" Pilichowski http://bantu.fm.interia.pl/
M A R G O T --> http://www.margot.cad.pl/
automatyczny t³umacz (wczesna wersja rozwojowa) angielsko-polski
Maciej Pilichowski wrote: Michael wrote:
I know I know its notoriously bad! I don't want to use it.
Why not? Goto is very useful since there is not labelled break. When you have nested for in another for /for example/ the easiest way /and elegant too/ to break from the external one is to use goto.
or return.
Why is your function so long?
--
Phlip http://industrialxp.org/community/bi...UserInterfaces This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hayri ERDENER |
last post by:
hi,
what is the equivalent of C languages' goto statement in python?
best regards
|
by: WindAndWaves |
last post by:
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
|
by: Tim Marshall |
last post by:
From http://www.mvps.org/access/tencommandments.htm
9th item:
Thou shalt not use "SendKeys", "Smart Codes" or "GoTo" (unless the GoTo
be part of an OnError process) for these will lead you from the path of
righteousness.
What about also using it as a means of exiting a procedure?
|
by: Rick |
last post by:
Hi,
For portability, can an issue arise if we use while(1) for an infinite
loop in C? If so, should we then use for(;;)? Thanks,
Rick
|
by: Debashish Chakravarty |
last post by:
K&R pg.66 describes two situations when using goto makes sense. Has
anyone here come across situations where using goto provided the most
elegant solution.
--
http://www.kashmiri-pandit.org/atrocities/index.html
| |
by: M.B |
last post by:
Guys,
Need some of your opinion on an oft beaten track
We have an option of using "goto" in C language, but most testbooks
(even K&R) advice against use of it.
My personal experience was that goto sometimes makes program some more
cleaner and easy to understand and also quite useful (in error handling
cases).
So why goto is outlawed from civilized c programmers community.
is there any technical inefficiency in that.
|
by: electrician |
last post by:
Perl has it, Basic has it, Fortran has it. What is so difficult about
creating a goto command for JavaScript. Just set up a label and say go
to it.
|
by: electrician |
last post by:
Yes, no GOTO. This is a major blunder on part of the creators of these
tools. GOTO gives the programmer the absolute control over the
program. Yes, no matter what, a GOTO sends the program to where YOU
want and takes the power away from the mean spirited CREATORS. Yes,
even GOD gave us free will! But the creators of JavaScript have
decided they will forever interfere in how YOU program. THEY have
decided to keep GOTO to themselves...
|
by: SoftEast |
last post by:
Hi Buddies,
I have read a lot of stuffs regarding not using GOTO statements to opt
a good programming style http://david.tribble.com/text/goto.html].
Can anybody give a particular lines of code which shows harmfullness
of GOTO.
SoftEast...
|
by: raashid bhatt |
last post by:
why are GOTO's not used they just a simple JMP instructions what's bad
about them
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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...
|
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: 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...
|
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 project—planning, coding, testing, and deployment—without 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: 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.
| |