Click here to Skip to main content
15,892,737 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: Classic Pin
peterchen26-Jul-07 11:59
peterchen26-Jul-07 11:59 
GeneralRe: Classic Pin
Vasudevan Deepak Kumar26-Jul-07 22:52
Vasudevan Deepak Kumar26-Jul-07 22:52 
GeneralRe: Classic Pin
John R. Shaw27-Jul-07 23:53
John R. Shaw27-Jul-07 23:53 
GeneralRe: Classic Pin
TClarke30-Jul-07 6:36
TClarke30-Jul-07 6:36 
GeneralRe: Classic Pin
Tom Clement30-Jul-07 13:07
professionalTom Clement30-Jul-07 13:07 
GeneralRe: Classic Pin
TClarke31-Jul-07 0:12
TClarke31-Jul-07 0:12 
GeneralRe: Classic Pin
kenpanda31-Jul-07 1:30
kenpanda31-Jul-07 1:30 
GeneralRe: Classic Pin
dojohansen20-Aug-07 2:20
dojohansen20-Aug-07 2:20 
It makes no difference, just like

if (((true == myFlagVariable) == true) != false)

is in fact equivalent to

if (myFlagVariable)


It's just that one version shows that the programmer understands that a boolean variable is in fact a boolean expression. So while it doesn't do much damage, it does show a lack of understanding -- excepting the occasional brainfart, which can surely happen to anyone.

I've also noted the habit of C programmers to write

if (null == var) ...

which to me just doesn't read naturally! I realise that they do this to avoid an unintensional assignment - a common and often subtle bug in C code:

if (var = null) ...

But in C# an assignment statement is not legal in an if condition, so it is a pointless practice. But I won't deny that habits are powerful and it may not be so easy for an old dog (C programmer) to change his ways. (I wish it was "her" ways more often, but for some reason girls are few and far between in our community.)
GeneralRe: Classic Pin
dojohansen20-Aug-07 2:26
dojohansen20-Aug-07 2:26 
GeneralRe: Classic Pin
Chris Losinger24-Jul-07 7:04
professionalChris Losinger24-Jul-07 7:04 
GeneralRe: Classic == false Pin
Andy Brummer24-Jul-07 7:41
sitebuilderAndy Brummer24-Jul-07 7:41 
GeneralRe: Classic == false Pin
dojohansen20-Aug-07 2:33
dojohansen20-Aug-07 2:33 
GeneralRe: Classic Pin
Pete O'Hanlon24-Jul-07 22:49
mvePete O'Hanlon24-Jul-07 22:49 
GeneralRe: Classic Pin
Luis Alonso Ramos25-Jul-07 19:07
Luis Alonso Ramos25-Jul-07 19:07 
GeneralRe: Classic Pin
Vasudevan Deepak Kumar26-Jul-07 22:53
Vasudevan Deepak Kumar26-Jul-07 22:53 
GeneralRe: Classic Pin
Luis Alonso Ramos27-Jul-07 5:28
Luis Alonso Ramos27-Jul-07 5:28 
GeneralRe: Classic Pin
dean.wilde9-Aug-07 12:40
dean.wilde9-Aug-07 12:40 
Generaltypeof(string)? Meh. Pin
DavidNohejl23-Jul-07 5:59
DavidNohejl23-Jul-07 5:59 
GeneralRe: typeof(string)? Meh. Pin
PIEBALDconsult23-Jul-07 8:27
mvePIEBALDconsult23-Jul-07 8:27 
GeneralRe: typeof(string)? Meh. Pin
DavidNohejl23-Jul-07 8:32
DavidNohejl23-Jul-07 8:32 
GeneralRe: typeof(string)? Meh. Pin
PIEBALDconsult23-Jul-07 8:37
mvePIEBALDconsult23-Jul-07 8:37 
GeneralRe: typeof(string)? Meh. Pin
Paul Conrad23-Jul-07 12:11
professionalPaul Conrad23-Jul-07 12:11 
GeneralRe: typeof(string)? Meh. Pin
Andy Brummer23-Jul-07 8:46
sitebuilderAndy Brummer23-Jul-07 8:46 
GeneralRe: typeof(string)? Meh. Pin
dojohansen20-Aug-07 2:51
dojohansen20-Aug-07 2:51 
GeneralRe: typeof(string)? Meh. Pin
PaulPrice23-Jul-07 9:59
PaulPrice23-Jul-07 9: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.