Click here to Skip to main content
15,890,186 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.

 
GeneralThe Loop Pin
cigicd17-Sep-08 4:10
cigicd17-Sep-08 4:10 
GeneralRe: The Loop Pin
CPallini17-Sep-08 5:27
mveCPallini17-Sep-08 5:27 
GeneralRe: The Loop Pin
StevenWalsh17-Sep-08 9:25
StevenWalsh17-Sep-08 9:25 
GeneralRe: The Loop Pin
dighn17-Sep-08 9:58
dighn17-Sep-08 9:58 
GeneralOT Pin
CPallini17-Sep-08 10:11
mveCPallini17-Sep-08 10:11 
GeneralRe: The Loop Pin
Joe Woodbury17-Sep-08 11:00
professionalJoe Woodbury17-Sep-08 11:00 
GeneralRe: The Loop Pin
Paul Conrad17-Sep-08 15:33
professionalPaul Conrad17-Sep-08 15:33 
GeneralTo me this is a coding horror, and to you? [modified] Pin
geoffs15-Sep-08 20:35
geoffs15-Sep-08 20:35 
First, let me say that the code excerpt below is not an egregious violation (and maybe not a violation at all), but it is a coding horror for my programming style and I am curious as to what the others here think about it.

So, in reviewing a coworker's code I come across the following line:
m_boolVar = (intVar == 0 ? false : true) ;

Yes, parenthesization and spacing exactly as shown above. Were it my code, it would have been written as:
m_boolVar = intVar != 0; // (corrected from == 0 by GDavy -- I typed too fast!

...or if I was feeling in a bit more perverse mood:
m_boolVar = !!intVar;

There were much bigger fish to fry in this code, but there are times when I just can't let things like this go by. These things are like misspelled words that shout out at me from among the surrounding text.

modified on Tuesday, September 16, 2008 3:02 AM

GeneralRe: To me this is a coding horror, and to you? Pin
GDavy15-Sep-08 20:47
GDavy15-Sep-08 20:47 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs15-Sep-08 20:50
geoffs15-Sep-08 20:50 
GeneralRe: To me this is a coding horror, and to you? Pin
GDavy16-Sep-08 3:23
GDavy16-Sep-08 3:23 
GeneralRe: To me this is a coding horror, and to you? PinPopular
QuiJohn16-Sep-08 4:16
QuiJohn16-Sep-08 4:16 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs16-Sep-08 4:25
geoffs16-Sep-08 4:25 
GeneralRe: To me this is a coding horror, and to you? Pin
Megidolaon15-Sep-08 20:55
Megidolaon15-Sep-08 20:55 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs15-Sep-08 21:02
geoffs15-Sep-08 21:02 
GeneralRe: To me this is a coding horror, and to you? Pin
CDP180216-Sep-08 4:39
CDP180216-Sep-08 4:39 
GeneralRe: To me this is a coding horror, and to you? [modified] Pin
geoffs16-Sep-08 4:52
geoffs16-Sep-08 4:52 
GeneralRe: To me this is a coding horror, and to you? Pin
BillW3316-Sep-08 6:02
professionalBillW3316-Sep-08 6:02 
GeneralRe: To me this is a coding horror, and to you? Pin
CDP180216-Sep-08 6:03
CDP180216-Sep-08 6:03 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs16-Sep-08 6:19
geoffs16-Sep-08 6:19 
GeneralRe: To me this is a coding horror, and to you? Pin
CDP180216-Sep-08 21:53
CDP180216-Sep-08 21:53 
GeneralRe: To me this is a coding horror, and to you? Pin
Kevin McFarlane17-Sep-08 0:24
Kevin McFarlane17-Sep-08 0:24 
GeneralRe: To me this is a coding horror, and to you? Pin
Megidolaon25-Feb-09 22:26
Megidolaon25-Feb-09 22:26 
GeneralRe: To me this is a coding horror, and to you? Pin
Dan Neely16-Sep-08 2:08
Dan Neely16-Sep-08 2:08 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs16-Sep-08 3:17
geoffs16-Sep-08 3:17 

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.