|
|
Warp wrote:
> I disagree. I have been writing C++ for hobby and professionally for
> over 10 years, and the total amount of C++ I have written is probably
> closer to 100k lines of code. I don't remember *ever* writing even a
> single "goto".
Note that calling "return" in the middle of a function is equivalent to
"goto". :-) Arguably "continue" and "break" and exceptions as well.
Those are all non-structured constructs.
And, of course, depending on your language, "goto" may be more or less
common. Take break and continue out of your loops, take try/finally out
of your exception handling, and suddenly there's places where "goto" is
cleaner.
Admittedly, not a lot. Indeed, Tcl doesn't even have a goto. For a
language where it's pretty trivial to implement your own control
structures, I think I'd have a hard time implementing "goto" in Tcl.
> It's not like I avoid it. I just don't need it. (Usually good basic
> encapsulation takes automatically care of anything that would be an
> "acceptable use of goto" otherwise.)
Agreed. I was just trying to say that there are people who think "goto"
is inherently evil, and that globals are inherently evil, because that's
what they've been taught, but that's really just lies-to-children until
they have enough experience to learn the few places where it really does
make more sense.
And then as programming languages evolve, they incorporate the good
places to use a goto into the syntax of the language and call it
something else, like "try/catch" or "return".
Go back to Pascal with no break, no early return, no exceptions, and
you'll realize where you miss your "return". :-)
> Global variables (inside namespaces or not) is not something I have used
> a lot, but I have a few times. I believe I can rationally argue for the
> rationality of each one.
Yep.
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
|