01-09-2010, 06:03 PM
(01-09-2010, 07:23 AM)Beta™ Wrote: I decided to add a goto statement
No! Goto statements are considered bad practice in C++ because they cause spagetti-code. Use some other form of conditional statement where possible.
Quote:The primary problem with goto is that it allows a programmer to cause the point of execution to jump around the code arbitrarily. This creates what is not-so-affectionately known as spaghetti code. Spaghetti code has a path of execution that resembles a bowl of spaghetti (all tangled and twisted), making it extremely difficult to follow the logic of such code.
As Dijkstra says somewhat humorously, "the quality of programmers is a decreasing function of the density of go to statements in the programs they produce".
To read Dijkstra's paper, click here.
The little boat gently drifted across the pond exactly the way a bowling ball wouldn't.