Click here to Skip to main content
15,898,538 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: Redundancy Peaking Pin
Sander Rossel16-Aug-11 7:13
professionalSander Rossel16-Aug-11 7:13 
GeneralRe: Redundancy Peaking PinPopular
mdblack9816-Aug-11 2:33
mdblack9816-Aug-11 2:33 
GeneralRe: Redundancy Peaking Pin
streamcap16-Aug-11 2:53
streamcap16-Aug-11 2:53 
GeneralRe: Redundancy Peaking Pin
BrainiacV16-Aug-11 3:20
BrainiacV16-Aug-11 3:20 
GeneralRe: Redundancy Peaking Pin
User 259821516-Aug-11 4:33
User 259821516-Aug-11 4:33 
GeneralRe: Redundancy Peaking Pin
V.16-Aug-11 4:45
professionalV.16-Aug-11 4:45 
GeneralRe: Redundancy Peaking Pin
Ralph Little16-Aug-11 6:54
Ralph Little16-Aug-11 6:54 
GeneralRe: Redundancy Peaking Pin
wbaxter3716-Aug-11 5:32
wbaxter3716-Aug-11 5:32 
I confess that I tend to do this, but I do have a reason.

I program in multiple languages. Not explicitly calling out an equality in a dynamic and loosely typed language like Ruby can give you unexpected results. A variable will evaluate to true if it is true or has an assigned value (even if it's an empty string). It will evaluate to false if it is false or nil.

In the interest of clarity I tend to make logical tests explicit and let the compiler take care of things. Turbo C 1.5 optimized this way back when, so I'm sure VS2010 can handle it.

There's no harm in being explicit in one's source code. It's like using "extra" parentheses. It doesn't matter to the tools, but it sure does make reading the code easier for us humans. Not to say i don't appreciate obfuscated C, it's just I do't want to have to modify it and make it work.
JokeRe: Redundancy Peaking PinPopular
PaulLinton16-Aug-11 13:08
PaulLinton16-Aug-11 13:08 
GeneralRe: Redundancy Peaking Pin
Shameel17-Aug-11 1:59
professionalShameel17-Aug-11 1:59 
GeneralRe: Redundancy Peaking Pin
Bernhard Hiller17-Aug-11 3:08
Bernhard Hiller17-Aug-11 3:08 
JokeMessage Removed Pin
18-Aug-11 7:25
professionalN_tro_P18-Aug-11 7:25 
GeneralRe: Redundancy Peaking Pin
PaulLinton18-Aug-11 12:08
PaulLinton18-Aug-11 12:08 
GeneralRe: Redundancy Peaking Pin
R. Erasmus17-Aug-11 1:24
R. Erasmus17-Aug-11 1:24 
GeneralRe: Redundancy Peaking Pin
Vladimir Svyatski18-Aug-11 9:18
professionalVladimir Svyatski18-Aug-11 9:18 
GeneralRe: Redundancy Peaking Pin
Bert Mitton29-Aug-11 7:42
professionalBert Mitton29-Aug-11 7:42 
GeneralTry Catch - at least it won't break Pin
RCoate11-Aug-11 17:27
RCoate11-Aug-11 17:27 
GeneralRe: Try Catch - at least it won't break Pin
leppie12-Aug-11 3:47
leppie12-Aug-11 3:47 
GeneralRe: Try Catch - at least it won't break Pin
GibbleCH15-Aug-11 5:28
GibbleCH15-Aug-11 5:28 
GeneralRe: Try Catch - at least it won't break Pin
BillW3322-Aug-11 6:54
professionalBillW3322-Aug-11 6:54 
Generalif .... else case Pin
Colin Mullikin11-Aug-11 2:31
professionalColin Mullikin11-Aug-11 2:31 
GeneralRe: if .... else case Pin
BobJanova11-Aug-11 4:05
BobJanova11-Aug-11 4:05 
QuestionRe: if .... else case Pin
Lutosław11-Aug-11 23:25
Lutosław11-Aug-11 23:25 
AnswerRe: if .... else case Pin
TorstenFrings12-Aug-11 1:13
TorstenFrings12-Aug-11 1:13 
GeneralRe: if .... else case Pin
Lutosław12-Aug-11 1:44
Lutosław12-Aug-11 1:44 

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.