Click here to Skip to main content
15,888,003 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: Which code you suggest? Pin
OriginalGriff25-Jul-13 8:31
mveOriginalGriff25-Jul-13 8:31 
GeneralRe: Which code you suggest? Pin
ZurdoDev25-Jul-13 8:35
professionalZurdoDev25-Jul-13 8:35 
GeneralRe: Which code you suggest? Pin
Andrew Leeder25-Jul-13 22:34
Andrew Leeder25-Jul-13 22:34 
GeneralRe: Which code you suggest? Pin
OriginalGriff25-Jul-13 22:50
mveOriginalGriff25-Jul-13 22:50 
GeneralRe: Which code you suggest? Pin
SortaCore25-Jul-13 23:15
SortaCore25-Jul-13 23:15 
GeneralRe: Which code you suggest? PinPopular
OriginalGriff25-Jul-13 23:22
mveOriginalGriff25-Jul-13 23:22 
GeneralRe: Which code you suggest? Pin
SortaCore25-Jul-13 23:39
SortaCore25-Jul-13 23:39 
GeneralRe: Which code you suggest? Pin
Stefan_Lang26-Jul-13 0:19
Stefan_Lang26-Jul-13 0:19 
Easy: introduce a flag indicating when you're done processing (for whatever reason). You can either add that flag to the breaking condition of control statements, or add a single additional nesting layer inquiring the state of that flag everytime you're about to do some more processing (that could be skipped).

I've been using that concept successfully for a long time in legacy applications that have lots of very long functions with very high nesting levels. This method at most adds one nesting level, if at all, and it helps keeping track of stuff I need to clean up at various nesting levels before actually exiting the function.
GeneralRe: Which code you suggest? Pin
OriginalGriff26-Jul-13 0:26
mveOriginalGriff26-Jul-13 0:26 
GeneralRe: Which code you suggest? Pin
Stefan_Lang26-Jul-13 1:27
Stefan_Lang26-Jul-13 1:27 
GeneralRe: Which code you suggest? Pin
svella26-Jul-13 4:42
svella26-Jul-13 4:42 
QuestionRe: Which code you suggest? Pin
Amir Mohammad Nasrollahi28-Jul-13 1:55
professionalAmir Mohammad Nasrollahi28-Jul-13 1:55 
GeneralRe: Which code you suggest? Pin
Stefan_Lang28-Jul-13 22:21
Stefan_Lang28-Jul-13 22:21 
GeneralRe: Which code you suggest? Pin
svella29-Jul-13 4:02
svella29-Jul-13 4:02 
GeneralRe: Which code you suggest? Pin
Stefan_Lang29-Jul-13 22:48
Stefan_Lang29-Jul-13 22:48 
GeneralRe: Which code you suggest? Pin
svella30-Jul-13 3:57
svella30-Jul-13 3:57 
GeneralRe: Which code you suggest? Pin
PIEBALDconsult30-Jul-13 5:44
mvePIEBALDconsult30-Jul-13 5:44 
GeneralRe: Which code you suggest? Pin
Renzo Ciafardone27-Jul-13 16:49
Renzo Ciafardone27-Jul-13 16:49 
GeneralRe: Which code you suggest? Pin
Fabio Franco26-Jul-13 2:59
professionalFabio Franco26-Jul-13 2:59 
GeneralRe: Which code you suggest? Pin
Klaus-Werner Konrad1-Aug-13 12:32
Klaus-Werner Konrad1-Aug-13 12:32 
GeneralRe: Which code you suggest? Pin
Sentenryu25-Jul-13 8:46
Sentenryu25-Jul-13 8:46 
GeneralRe: Which code you suggest? Pin
ZurdoDev30-Jul-13 5:44
professionalZurdoDev30-Jul-13 5:44 
GeneralRe: Which code you suggest? Pin
PIEBALDconsult30-Jul-13 5:43
mvePIEBALDconsult30-Jul-13 5:43 
GeneralRe: Which code you suggest? Pin
César de Souza26-Jul-13 3:06
professionalCésar de Souza26-Jul-13 3:06 
GeneralRe: Which code you suggest? Pin
Argonia26-Jul-13 3:59
professionalArgonia26-Jul-13 3:59 

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.