M
Marko Rauhamaa
Thomas Rachel said:Essentially, you can write both good and bad code both with and
without goto.
Point is, choose tasteful idioms in your code.
Marko
Thomas Rachel said:Essentially, you can write both good and bad code both with and
without goto.
Am 08.06.2014 05:58 schrieb Rustom Mody:
And became widely misunderstood. If anybody would read the whole what he
wrote, people would learn that he doesn't criticise the *use* of goto,
but he wants the *replacement* of goto with something else (like
exceptions).
As C doesn't have exceptions, goto is in many cases the simplest and
easiest way of handling errors.
Essentially, you can write both good and bad code both with and without
goto.
http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html ....
And here is Hoare...
| Ada has a plethora of features and notational conventions, many of them
| unnecessary and some of them, like exception handling, even
| dangerous. Do not allow this language in its present state to be
| used in applications where reliability is critical.
Am 08.06.2014 05:58 schrieb Rustom Mody:
And became widely misunderstood. If anybody would read the whole what he
wrote, people would learn that he doesn't criticise the *use* of goto,
but he wants the *replacement* of goto with something else (like
exceptions).
As C doesn't have exceptions, goto is in many cases the simplest and
easiest way of handling errors.
Essentially, you can write both good and bad code both with and without
goto.
Thomaas
I entirely agree. I find it incredible that some people find it so
difficult to differentiate having tens or even hundreds of gotos
leaping around willy nilly to a similar number of labels, and a
similar number of gotos targetted at one label called SNAFU or
whatever.
I've seen some amazingly convoluted C code where people got themselves
wrapped around the axle six different ways in order to avoid using
"goto fail" or "goto retry". Invariably I was looking at the code
because it didn't work right and needed to be fixed. Usually the
addition of a 'fail' label and a few gotos allowed me to throw out all
sorts of complexly nested if/else blocks, status flags, and
unnecessary while loops. Usually you can reduce the number of lines
of code (sometimes by half or more) while also reducing the number and
nesting of control structures. And when you're done it works right!
Chris Angelico said:Yeah. As soon as you take on board a hard-and-fast rule, you open
yourself up to stupid cases where the rule ought to have been broken.
I don't know a single piece of programming advice which, if taken as
an inviolate rule, doesn't at some point cause suboptimal code.
How about, "Don't use PHP"?
Chris Angelico wrote:
#
How about, "Don't use PHP"?
Sounds like the exception that proves the rule!
I don't know
a single piece of programming advice which, if taken as an inviolate
rule, doesn't at some point cause suboptimal code.
"Don't try to program while your cat is sleeping on the keyboard."
[/QUOTE]"Don't try to program while your cat is sleeping on the keyboard."
Hmm. I've never actually heard that one. Is it commonly taught in
programming classes? Because I haven't taken any.
wrote:
"Don't try to program while your cat is sleeping on the keyboard."
On 11 June 2014 10:00, Steven D'Aprano
<[email protected]
"Don't try to program while your cat is sleeping on the keyboard."
Lying down, the weight is spread across the whole keyboard so you're
unlikely to suffer extra keypresses due to the cat. So if you're a
touch-typist that one may not be too bad (depending on how easily their
fur gets up your nose).
Now, a cat *standing* on the keyboard, between you and the monitor, and
rubbing his head against your hands, is a whole other matter.
Tim Delaney
Does it make any difference if the cat is European or African?
What? I don't know..... AAAAAAAAAAAAAAAAAAAAAAAAAAAAARGH!
ChrisA
Would be interesting to get their collective take on C++...
Are there any good parts? It appears the book was cancelled
(note the remarks):
alister said:My cat is a better programmer than I am !
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.