Click here to Skip to main content
13,348,514 members (80,699 online)

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: Bug of the day Pin
StatementTerminator13-Jun-13 6:21
memberStatementTerminator13-Jun-13 6:21 
JokeRe: Bug of the day Pin
Bernhard Hiller12-Jun-13 22:27
professionalBernhard Hiller12-Jun-13 22:27 
GeneralRe: Bug of the day Pin
R. Erasmus12-Jun-13 22:38
memberR. Erasmus12-Jun-13 22:38 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 2:21
memberFabio Franco13-Jun-13 2:21 
GeneralRe: Bug of the day Pin
gervacleto13-Jun-13 3:24
membergervacleto13-Jun-13 3:24 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 3:54
memberFabio Franco13-Jun-13 3:54 
GeneralRe: Bug of the day Pin
gervacleto13-Jun-13 4:45
membergervacleto13-Jun-13 4:45 
GeneralRe: Bug of the day Pin
Pablo Aliskevicius13-Jun-13 4:53
memberPablo Aliskevicius13-Jun-13 4:53 
I usually prefer:
if (42 == ComputeSomeThing(x)) {
//...
}

This one avoids the = against == pit.
Another thing I do: my IDE is configured to show operators (like '(){};,+-=...') in color, so they are a bit harder to miss (like the original example).
There are two other tools that can help with this: compiler warnings, and static code analysis.

JM2B,
Pablo.

"Accident: An inevitable occurrence due to the action of immutable natural laws." (Ambrose Bierce, circa 1899).

GeneralRe: Bug of the day Pin
StatementTerminator13-Jun-13 6:40
memberStatementTerminator13-Jun-13 6:40 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 4:54
memberFabio Franco13-Jun-13 4:54 
GeneralRe: Bug of the day Pin
MainFrameMan_ALIVE_AND_WELL$$13-Jun-13 5:32
memberMainFrameMan_ALIVE_AND_WELL$$13-Jun-13 5:32 
GeneralRe: Bug of the day Pin
RafagaX13-Jun-13 6:31
memberRafagaX13-Jun-13 6:31 
GeneralRe: Bug of the day Pin
Adam David Hill14-Jun-13 6:26
memberAdam David Hill14-Jun-13 6:26 
GeneralRe: Bug of the day Pin
Marc Clifton18-Jun-13 6:32
protectorMarc Clifton18-Jun-13 6:32 
GeneralProductivity Wars Pin
jim lahey7-Jun-13 5:42
memberjim lahey7-Jun-13 5:42 
GeneralRe: Productivity Wars Pin
BobJanova7-Jun-13 5:57
memberBobJanova7-Jun-13 5:57 
GeneralRe: Productivity Wars Pin
jim lahey7-Jun-13 6:04
memberjim lahey7-Jun-13 6:04 
GeneralRe: Productivity Wars Pin
R. Erasmus11-Jun-13 4:28
memberR. Erasmus11-Jun-13 4:28 
GeneralRe: Productivity Wars Pin
jesarg7-Jun-13 7:14
memberjesarg7-Jun-13 7:14 
GeneralRe: Productivity Wars Pin
Chris Maunder7-Jun-13 15:57
adminChris Maunder7-Jun-13 15:57 
GeneralRe: Productivity Wars Pin
AspDotNetDev7-Jun-13 16:18
protectorAspDotNetDev7-Jun-13 16:18 
GeneralRe: Productivity Wars Pin
V.9-Jun-13 23:22
professionalV.9-Jun-13 23:22 
GeneralRe: Productivity Wars Pin
harold aptroot10-Jun-13 4:19
memberharold aptroot10-Jun-13 4:19 
GeneralRe: Productivity Wars Pin
YvesDaoust10-Jun-13 21:47
memberYvesDaoust10-Jun-13 21:47 
GeneralRe: Productivity Wars Pin
Fran Porretto11-Jun-13 2:00
memberFran Porretto11-Jun-13 2:00 

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.


Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 18 Jan 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid