Click here to Skip to main content
15,891,248 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: app as an object name Pin
kmoorevs29-Mar-12 2:34
kmoorevs29-Mar-12 2:34 
GeneralGotoless programming PinPopular
andrewgissing22-Feb-12 1:59
andrewgissing22-Feb-12 1:59 
GeneralRe: Gotoless programming PinPopular
CDP180222-Feb-12 2:22
CDP180222-Feb-12 2:22 
GeneralRe: Gotoless programming PinPopular
Bull City Rambler23-Feb-12 15:21
Bull City Rambler23-Feb-12 15:21 
GeneralRe: Gotoless programming PinPopular
OriginalGriff23-Feb-12 21:23
mveOriginalGriff23-Feb-12 21:23 
GeneralRe: Gotoless programming Pin
SortaCore28-Feb-12 7:39
SortaCore28-Feb-12 7:39 
GeneralRe: Gotoless programming Pin
OriginalGriff28-Feb-12 8:07
mveOriginalGriff28-Feb-12 8:07 
GeneralRe: Gotoless programming PinPopular
archimboldo28-Feb-12 8:11
archimboldo28-Feb-12 8:11 
Not that I have used it, but the case some have made is breaking out of deeply nested loops (and not with exceptions):

for (i = 0; i < end; i++) {
doSomething();
for(j = obj[i].getAnotherObj(); j++; obj[i].end()) {
doSomethingElse();
for(k = anotherObj[j].getYetAnotherObj(); k++; anotherObj[j].end()) {
if (yetAnotherObj[k].condition())
goto breakOutOfDeeplyNestedLoop;
doYetSomethingElse();
}
blahBlah();
}
blahBlahBlah();
}
breakOutOfDeeplyNestedLoop:
moreStuffInThisMethod();

You could use exceptions, but that's really a misuse of them if the condition is not truly exceptional.
GeneralRe: Gotoless programming Pin
SortaCore28-Feb-12 8:42
SortaCore28-Feb-12 8:42 
GeneralRe: Gotoless programming Pin
Mark Kruger28-Feb-12 10:44
Mark Kruger28-Feb-12 10:44 
GeneralRe: Gotoless programming Pin
SortaCore28-Feb-12 17:34
SortaCore28-Feb-12 17:34 
GeneralRe: Gotoless programming Pin
Mark Kruger28-Feb-12 21:16
Mark Kruger28-Feb-12 21:16 
GeneralRe: Gotoless programming Pin
SortaCore29-Feb-12 6:51
SortaCore29-Feb-12 6:51 
GeneralRe: Gotoless programming Pin
Mark Kruger29-Feb-12 8:31
Mark Kruger29-Feb-12 8:31 
GeneralRe: Gotoless programming Pin
Ahmedn128-Feb-12 8:41
Ahmedn128-Feb-12 8:41 
GeneralRe: Gotoless programming Pin
BobJanova28-Feb-12 22:33
BobJanova28-Feb-12 22:33 
GeneralRe: Gotoless programming Pin
DragonHeart33528-Feb-12 1:13
DragonHeart33528-Feb-12 1:13 
GeneralRe: Gotoless programming Pin
scott_m557428-Feb-12 3:25
scott_m557428-Feb-12 3:25 
GeneralRe: Gotoless programming Pin
Mike Winiberg27-Feb-12 21:14
professionalMike Winiberg27-Feb-12 21:14 
GeneralRe: Gotoless programming Pin
englebart28-Feb-12 2:06
professionalenglebart28-Feb-12 2:06 
GeneralRe: Gotoless programming Pin
code_junkie28-Feb-12 2:42
code_junkie28-Feb-12 2:42 
GeneralRe: Gotoless programming Pin
Renzo Ciafardone28-Feb-12 3:53
Renzo Ciafardone28-Feb-12 3:53 
GeneralRe: Gotoless programming Pin
Marbry Hardin28-Feb-12 4:28
Marbry Hardin28-Feb-12 4:28 
GeneralRe: Gotoless programming Pin
code_junkie28-Feb-12 4:52
code_junkie28-Feb-12 4:52 
GeneralRe: Gotoless programming Pin
BobJanova28-Feb-12 5:11
BobJanova28-Feb-12 5:11 

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.