Click here to Skip to main content
15,887,683 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
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 
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 
Flags and/or gotos are both reasonable approaches in languages that don't have a try...finally construct and I've written code using both approaches in many different languages. Since the OP was obviously C# I assumed that is what we were talking about, and in C# the try..finally (or the "using" construct, when applicable) is definitely the cleanest approach to making sure your resource cleanup happens, even when you don't think exceptions enter into the picture, though in my experience most cases where resource cleanup happens, exceptions at the .NET framework level are almost always a possibility.

And no I wouldn't suggest try..finally for the original post because no resource cleanup is involved.
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 
GeneralRe: Which code you suggest? Pin
César de Souza26-Jul-13 4:41
professionalCésar de Souza26-Jul-13 4:41 
GeneralRe: Which code you suggest? Pin
Ancandune26-Jul-13 2:19
Ancandune26-Jul-13 2:19 
GeneralRe: Which code you suggest? Pin
ZurdoDev26-Jul-13 2:21
professionalZurdoDev26-Jul-13 2:21 
GeneralRe: Which code you suggest? Pin
Ravi Bhavnani29-Jul-13 11:16
professionalRavi Bhavnani29-Jul-13 11:16 
GeneralRe: Which code you suggest? Pin
ZurdoDev29-Jul-13 14:45
professionalZurdoDev29-Jul-13 14:45 
GeneralRe: Which code you suggest? Pin
Ravi Bhavnani30-Jul-13 5:05
professionalRavi Bhavnani30-Jul-13 5:05 

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.