Click here to Skip to main content
15,886,963 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: Do you not understand booleans? Pin
fjdiewornncalwe13-Dec-11 7:08
professionalfjdiewornncalwe13-Dec-11 7:08 
GeneralRe: Do you not understand booleans? Pin
YvesDaoust1-Jan-12 23:50
YvesDaoust1-Jan-12 23:50 
GeneralRe: Do you not understand booleans? Pin
KP Lee13-Dec-11 19:19
KP Lee13-Dec-11 19:19 
GeneralRe: Do you not understand booleans? Pin
Clive D. Pottinger15-Dec-11 17:09
Clive D. Pottinger15-Dec-11 17:09 
GeneralRe: Do you not understand booleans? Pin
John Hunley19-Dec-11 6:47
John Hunley19-Dec-11 6:47 
GeneralRe: Do you not understand booleans? Pin
YvesDaoust2-Jan-12 0:10
YvesDaoust2-Jan-12 0:10 
GeneralRe: Do you not understand booleans? Pin
Jeroen De Dauw25-Dec-11 11:24
Jeroen De Dauw25-Dec-11 11:24 
GeneralRe: Do you not understand booleans? Pin
ChunkyStool3-Jan-12 12:25
ChunkyStool3-Jan-12 12:25 
I'm with you on this one! Sometimes verbosity improves readability, but there are many cases where it's just dumb.

The first example is terrible:
C#
bool is_queue_empty(void)
{
    if (queue_length==0)
    {
        return true;
    }
    else
    {
        return false;
    }
}


More code & multiple exit points -- for zero benefit???!!!
Dead | X|

This would be better:
C#
bool is_queue_empty(void)
{
    return queue_length == 0;
}

Smile | :)
GeneralI just found... Pin
TorstenH.4-Dec-11 23:38
TorstenH.4-Dec-11 23:38 
GeneralRe: I just found... Pin
CDP18025-Dec-11 2:06
CDP18025-Dec-11 2:06 
GeneralRe: I just found... Pin
Nagy Vilmos5-Dec-11 4:29
professionalNagy Vilmos5-Dec-11 4:29 
GeneralRe: I just found... Pin
Albert Holguin5-Dec-11 4:35
professionalAlbert Holguin5-Dec-11 4:35 
GeneralRe: I just found... Pin
Sander Rossel7-Dec-11 20:56
professionalSander Rossel7-Dec-11 20:56 
QuestionA happy programmer Pin
eyesark2-Dec-11 20:17
eyesark2-Dec-11 20:17 
AnswerRe: A happy programmer Pin
eyesark2-Dec-11 21:15
eyesark2-Dec-11 21:15 
GeneralRe: A happy programmer Pin
alanevans6-Dec-11 3:15
alanevans6-Dec-11 3:15 
AnswerRe: A happy programmer Pin
Dalek Dave2-Dec-11 21:25
professionalDalek Dave2-Dec-11 21:25 
GeneralRe: A happy programmer Pin
Wayne Gaylard2-Dec-11 21:37
professionalWayne Gaylard2-Dec-11 21:37 
GeneralRe: A happy programmer Pin
Jörgen Andersson2-Dec-11 22:48
professionalJörgen Andersson2-Dec-11 22:48 
GeneralRe: A happy programmer Pin
Gary R. Wheeler3-Dec-11 0:54
Gary R. Wheeler3-Dec-11 0:54 
GeneralRe: A happy programmer Pin
Alberto Bar-Noy4-Dec-11 0:12
Alberto Bar-Noy4-Dec-11 0:12 
GeneralRe: A happy programmer Pin
Jan Steyn4-Dec-11 4:32
Jan Steyn4-Dec-11 4:32 
GeneralRe: A happy programmer Pin
0bx5-Dec-11 0:16
0bx5-Dec-11 0:16 
AnswerRe: A happy programmer PinPopular
PIEBALDconsult3-Dec-11 3:25
mvePIEBALDconsult3-Dec-11 3:25 
GeneralRe: A happy programmer Pin
Wonde Tadesse4-Dec-11 11:39
professionalWonde Tadesse4-Dec-11 11:39 

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.