Click here to Skip to main content
15,887,847 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: So, a colleague inherited a project to restructure a product.. Pin
Brisingr Aerowing20-Dec-13 5:29
professionalBrisingr Aerowing20-Dec-13 5:29 
GeneralYes - It was me Pin
Marco Bertschi16-Dec-13 0:53
protectorMarco Bertschi16-Dec-13 0:53 
GeneralRe: Yes - It was me Pin
Manfred Rudolf Bihy16-Dec-13 1:23
professionalManfred Rudolf Bihy16-Dec-13 1:23 
GeneralRe: Yes - It was me Pin
Marco Bertschi16-Dec-13 3:18
protectorMarco Bertschi16-Dec-13 3:18 
GeneralRe: Yes - It was me Pin
Manfred Rudolf Bihy16-Dec-13 3:22
professionalManfred Rudolf Bihy16-Dec-13 3:22 
GeneralRe: Yes - It was me Pin
Marco Bertschi16-Dec-13 4:31
protectorMarco Bertschi16-Dec-13 4:31 
GeneralRe: Yes - It was me Pin
Manfred Rudolf Bihy16-Dec-13 4:35
professionalManfred Rudolf Bihy16-Dec-13 4:35 
QuestionRe: Yes - It was me Pin
Pablo Aliskevicius16-Dec-13 4:40
Pablo Aliskevicius16-Dec-13 4:40 
Why didn't you use RAII?

C++
class  MutexLocker {
    QMutex &m;
public:
    MutexLocker(QMutex &qm) : m(qm) { m.lock(); }
    ~MutexLocker() { m.unlock(); }
}; // class

int GetStatus(){
   MutexLocker tmp(statusMutex);
   return status;
   // destructor unlocks 
}

Pablo.

"Accident: An inevitable occurrence due to the action of immutable natural laws." (Ambrose Bierce, circa 1899).
"You are to act in the light of experience as guided by intelligence" (Rex Stout, "In the Best Families", 1950).

GeneralRe: Yes - It was me Pin
Albert Holguin28-Dec-13 12:10
professionalAlbert Holguin28-Dec-13 12:10 
GeneralRe: Yes - It was me Pin
Albert Holguin28-Dec-13 12:08
professionalAlbert Holguin28-Dec-13 12:08 
GeneralRe: Yes - It was me Pin
charlieg14-Jan-14 23:17
charlieg14-Jan-14 23:17 
GeneralYes I know it was me who wrote that... PinPopular
GuyThiebaut10-Dec-13 5:51
professionalGuyThiebaut10-Dec-13 5:51 
GeneralRe: Yes I know it was me who wrote that... PinPopular
Richard Deeming10-Dec-13 5:58
mveRichard Deeming10-Dec-13 5:58 
GeneralRe: Yes I know it was me who wrote that... Pin
GuyThiebaut10-Dec-13 6:00
professionalGuyThiebaut10-Dec-13 6:00 
GeneralRe: Yes I know it was me who wrote that... Pin
BobJanova10-Dec-13 6:40
BobJanova10-Dec-13 6:40 
GeneralRe: Yes I know it was me who wrote that... Pin
Richard Deeming10-Dec-13 6:50
mveRichard Deeming10-Dec-13 6:50 
GeneralRe: Yes I know it was me who wrote that... PinPopular
BobJanova10-Dec-13 6:59
BobJanova10-Dec-13 6:59 
GeneralRe: Yes I know it was me who wrote that... Pin
Richard Deeming10-Dec-13 7:01
mveRichard Deeming10-Dec-13 7:01 
GeneralRe: Yes I know it was me who wrote that... Pin
OriginalGriff10-Dec-13 8:34
mveOriginalGriff10-Dec-13 8:34 
GeneralRe: Yes I know it was me who wrote that... Pin
CDP180210-Dec-13 17:09
CDP180210-Dec-13 17:09 
GeneralRe: Yes I know it was me who wrote that... Pin
OriginalGriff10-Dec-13 21:20
mveOriginalGriff10-Dec-13 21:20 
GeneralRe: Yes I know it was me who wrote that... Pin
Argonia10-Dec-13 20:36
professionalArgonia10-Dec-13 20:36 
GeneralRe: Yes I know it was me who wrote that... Pin
Richard Deeming11-Dec-13 2:27
mveRichard Deeming11-Dec-13 2:27 
GeneralRe: Yes I know it was me who wrote that... Pin
OriginalGriff11-Dec-13 3:00
mveOriginalGriff11-Dec-13 3:00 
GeneralRe: Yes I know it was me who wrote that... Pin
Richard Deeming11-Dec-13 3:27
mveRichard Deeming11-Dec-13 3:27 

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.