Click here to Skip to main content
15,888,521 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: Most Unhelpful Message Ever Pin
Andy Brummer1-Aug-13 9:09
sitebuilderAndy Brummer1-Aug-13 9:09 
GeneralRe: Most Unhelpful Message Ever Pin
Argonia1-Aug-13 21:36
professionalArgonia1-Aug-13 21:36 
GeneralRe: Most Unhelpful Message Ever Pin
pasztorpisti7-Sep-13 1:01
pasztorpisti7-Sep-13 1:01 
GeneralRe: Most Unhelpful Message Ever Pin
pasztorpisti7-Sep-13 0:59
pasztorpisti7-Sep-13 0:59 
GeneralRe: Most Unhelpful Message Ever Pin
jeron12-Aug-13 5:30
jeron12-Aug-13 5:30 
GeneralRe: Most Unhelpful Message Ever Pin
Chad3F2-Aug-13 13:03
Chad3F2-Aug-13 13:03 
GeneralRe: Most Unhelpful Message Ever Pin
pasztorpisti7-Sep-13 0:49
pasztorpisti7-Sep-13 0:49 
GeneralRe: Most Unhelpful Message Ever Pin
Chad3F7-Sep-13 12:40
Chad3F7-Sep-13 12:40 
While there are certainly some errors that can't be handled well/predictable (e.g. if memory was corrupted by a buffer overrun, then attempting to even show an error dialog may cause yet another error). But I don't think aborting the program should be done just because a thread couldn't be created (since it is generally an initialization error, like opening some required and missing resource file, not corruption making the running image unstable). If it was a problem beyond that (machine hardware or OS failing), then it doesn't really matter what any application does since you are likely going to have to hardboot your system anyway.

If I was using some editing application that internally spawns threads to perform certain [user triggered] operations, I don't want it exiting and loosing all my in-memory edits just because it couldn't create a thread to perform an operation that has yet to be run. I'd want an error message so that I have a chance to save my work and possibly restart the program. Worst case is trying to save also fails with another error and I'm out of luck, but otherwise being able to save is a better option.

And if the pthread functions failing was really such an unpassable wall, then why would they even return error codes at all and not abort the program for you? It is because they expect programmers to handle the error (even if that handling is _sometimes_ limited). There could be many reasons why these functions fail depending on the library implementation (or maybe just a localized coding error in the application itself).. so assuming they are always catastrophic reasons is just a narrow viewpoint.
GeneralRe: Most Unhelpful Message Ever Pin
pasztorpisti7-Sep-13 13:09
pasztorpisti7-Sep-13 13:09 
GeneralRe: Most Unhelpful Message Ever Pin
BillW3330-Aug-13 5:35
professionalBillW3330-Aug-13 5:35 
GeneralRe: Most Unhelpful Message Ever Pin
pasztorpisti7-Sep-13 0:34
pasztorpisti7-Sep-13 0:34 
QuestionWhich code you suggest? Pin
Rajesh Anuhya24-Jul-13 20:04
professionalRajesh Anuhya24-Jul-13 20:04 
AnswerRe: Which code you suggest? PinPopular
NeverJustHere24-Jul-13 21:02
NeverJustHere24-Jul-13 21:02 
GeneralRe: Which code you suggest? Pin
Reelix25-Jul-13 21:36
Reelix25-Jul-13 21:36 
GeneralRe: Which code you suggest? Pin
KP Lee26-Jul-13 17:21
KP Lee26-Jul-13 17:21 
AnswerRe: Which code you suggest? Pin
_Damian S_24-Jul-13 21:02
professional_Damian S_24-Jul-13 21:02 
AnswerRe: Which code you suggest? PinPopular
Ingo25-Jul-13 3:42
Ingo25-Jul-13 3:42 
AnswerRe: Which code you suggest? Pin
ZurdoDev25-Jul-13 4:48
professionalZurdoDev25-Jul-13 4:48 
GeneralRe: Which code you suggest? PinPopular
OriginalGriff25-Jul-13 5:04
mveOriginalGriff25-Jul-13 5:04 
GeneralRe: Which code you suggest? Pin
ZurdoDev25-Jul-13 5:11
professionalZurdoDev25-Jul-13 5:11 
GeneralRe: Which code you suggest? Pin
Sentenryu25-Jul-13 7:15
Sentenryu25-Jul-13 7:15 
GeneralRe: Which code you suggest? Pin
ZurdoDev25-Jul-13 7:32
professionalZurdoDev25-Jul-13 7:32 
GeneralRe: Which code you suggest? Pin
OriginalGriff25-Jul-13 8:26
mveOriginalGriff25-Jul-13 8:26 
GeneralRe: Which code you suggest? Pin
ZurdoDev25-Jul-13 8:28
professionalZurdoDev25-Jul-13 8:28 
GeneralRe: Which code you suggest? Pin
OriginalGriff25-Jul-13 8:31
mveOriginalGriff25-Jul-13 8:31 

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.