Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralODBC Database Metadata (All Table names) Pin
omair shafiq25-Jul-04 5:34
omair shafiq25-Jul-04 5:34 
GeneralRe: ODBC Database Metadata (All Table names) Pin
David Crow26-Jul-04 4:05
David Crow26-Jul-04 4:05 
GeneralC reateProcess Pin
Member 75213725-Jul-04 4:04
Member 75213725-Jul-04 4:04 
GeneralRe: C reateProcess Pin
PJ Arends25-Jul-04 10:06
professionalPJ Arends25-Jul-04 10:06 
Generalbandwidth monitoring Pin
Paolo Ponzano25-Jul-04 2:38
Paolo Ponzano25-Jul-04 2:38 
QuestionJumping out of a heavily-nested looping noy by using "goto" statement? Pin
Link260024-Jul-04 17:24
Link260024-Jul-04 17:24 
AnswerRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Ravi Bhavnani24-Jul-04 17:52
professionalRavi Bhavnani24-Jul-04 17:52 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Mike Dimmick25-Jul-04 5:30
Mike Dimmick25-Jul-04 5:30 
I recently saw a horrible code structure (thankfully that I didn't have to maintain) that looked like:
while ( TRUE )
{
   /* actions */

   if ( condition1 )
   {
      /* actions */
      break;
   }

   /* actions */

   if ( condition2 )
   {
      break;
   }

   /* actions */

   break;
}
Note the break at the bottom of the while block.

That's right: the while block isn't actually a loop at all - it's simply a device to get break to skip to the bottom of the block.

I'M NOT RECOMMENDING THIS. I think it's a horrible practice. It took me a good two hours to actually realise that it was, in fact, a goto.

When Dijkstra originally wrote his 'goto considered harmful' paper, he was pointing out the benefits of block control structures for those programmers using languages without them, or die-hard programmers not using those structures in the new languages. Uncontrolled, poorly-designed use of gotos is simply confusing - it's hard for a maintainer to know what's going on - but so is the misuse of any control structure. I don't recommend misusing exceptions in the way you suggest, either.

For more, see Gotos Considered Harmful and Other Programmers' Taboos[^].

Stability. What an interesting concept. -- Chris Maunder
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
peterchen25-Jul-04 6:13
peterchen25-Jul-04 6:13 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Ravi Bhavnani25-Jul-04 12:01
professionalRavi Bhavnani25-Jul-04 12:01 
AnswerRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Michael Dunn24-Jul-04 18:22
sitebuilderMichael Dunn24-Jul-04 18:22 
AnswerRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Johan Rosengren24-Jul-04 20:19
Johan Rosengren24-Jul-04 20:19 
AnswerRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
bikram singh24-Jul-04 21:53
bikram singh24-Jul-04 21:53 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Kevin McFarlane25-Jul-04 6:52
Kevin McFarlane25-Jul-04 6:52 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
bikram singh26-Jul-04 7:35
bikram singh26-Jul-04 7:35 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Kevin McFarlane30-Jul-04 8:24
Kevin McFarlane30-Jul-04 8:24 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
bikram singh31-Jul-04 2:32
bikram singh31-Jul-04 2:32 
AnswerRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Nemanja Trifunovic25-Jul-04 5:54
Nemanja Trifunovic25-Jul-04 5:54 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
David Crow26-Jul-04 4:29
David Crow26-Jul-04 4:29 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Henry miller26-Jul-04 6:48
Henry miller26-Jul-04 6:48 
AnswerRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
palbano25-Jul-04 17:47
palbano25-Jul-04 17:47 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
Link260025-Jul-04 18:04
Link260025-Jul-04 18:04 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
palbano25-Jul-04 18:43
palbano25-Jul-04 18:43 
GeneralRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
bikram singh26-Jul-04 7:33
bikram singh26-Jul-04 7:33 
AnswerRe: Jumping out of a heavily-nested looping noy by using "goto" statement? Pin
KarstenK25-Jul-04 21:20
mveKarstenK25-Jul-04 21:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.