Click here to Skip to main content
15,902,112 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: To me this is a coding horror, and to you? Pin
cpkilekofp25-Sep-08 10:16
cpkilekofp25-Sep-08 10:16 
JokeRe: To me this is a coding horror, and to you? Pin
leonej_dt25-Sep-08 10:19
leonej_dt25-Sep-08 10:19 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp25-Sep-08 10:25
cpkilekofp25-Sep-08 10:25 
GeneralRe: To me this is a coding horror, and to you? Pin
leonej_dt25-Sep-08 10:56
leonej_dt25-Sep-08 10:56 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp29-Sep-08 4:03
cpkilekofp29-Sep-08 4:03 
GeneralRe: To me this is a coding horror, and to you? Pin
leonej_dt29-Sep-08 17:49
leonej_dt29-Sep-08 17:49 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp30-Sep-08 7:00
cpkilekofp30-Sep-08 7:00 
GeneralRe: To me this is a coding horror, and to you? Pin
leonej_dt1-Oct-08 15:18
leonej_dt1-Oct-08 15:18 
cpkilekofp wrote:
Excuse me, sir, but the original coding horror in this thread is a C# coding horror, not a C coding horror,


The original post was a C coding horror:

geoffs wrote:
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.


Although the first two lines of code could also be valid C#, the third one can't be valid C#.

cpkilekofp wrote:
Additonally, I based my comments regarding your statements about coding standards on what exactly you wrote


My coding standards are those I have written one or two posts ago.

cpkilekofp wrote:
In general, the comments you've made on this topic are in line with what I call "C bigotry", an attitude that naturally comes to most good C programmers (I was most definitely guilty of it when C was my primary development language).


I'm actually more guilty of C++ bigotry. I seldom use classes (90% of my classes are Class-Wizard-generated GUI classes), but I'm very fond of function pointers and templates.

cpkilekofp wrote:
back when I was using C regularly, we had macros almost identical to yours to convert integers to true/false when we were building files for processing by, say, COBOL mainframe programs that looked for 0 or 1 as false or true (about 17-18 years ago)


Wow. I was 2 years old back then.

cpkilekofp wrote:
perhaps, your experience in different arenas of development seems to not be as widespread as mine


Agreed. I'm just a college student.

If you can play The Dance of Eternity (Dream Theater), then we shall make a band.

GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp2-Oct-08 5:49
cpkilekofp2-Oct-08 5:49 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp2-Oct-08 7:03
cpkilekofp2-Oct-08 7:03 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs2-Oct-08 10:34
geoffs2-Oct-08 10:34 
GeneralRe: To me this is a coding horror, and to you? Pin
David St. Hilaire24-Sep-08 14:01
David St. Hilaire24-Sep-08 14:01 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp25-Sep-08 3:49
cpkilekofp25-Sep-08 3:49 
GeneralSomeone please help me .... PinPopular
Monty211-Sep-08 18:27
Monty211-Sep-08 18:27 
GeneralRe: Someone please help me .... Pin
StM0n11-Sep-08 23:45
StM0n11-Sep-08 23:45 
JokeRe: Someone please help me .... Pin
BadKarma11-Sep-08 23:58
BadKarma11-Sep-08 23:58 
GeneralRe: Someone please help me .... Pin
dojohansen16-Sep-08 2:22
dojohansen16-Sep-08 2:22 
GeneralRe: Someone please help me .... Pin
cpkilekofp25-Sep-08 3:58
cpkilekofp25-Sep-08 3:58 
GeneralRe: Someone please help me .... Pin
Nagy Vilmos12-Sep-08 2:26
professionalNagy Vilmos12-Sep-08 2:26 
JokeRe: Someone please help me .... Pin
Chris Meech12-Sep-08 2:39
Chris Meech12-Sep-08 2:39 
JokeRe: Someone please help me .... Pin
CPallini12-Sep-08 3:35
mveCPallini12-Sep-08 3:35 
GeneralRe: Someone please help me .... Pin
dojohansen16-Sep-08 2:24
dojohansen16-Sep-08 2:24 
GeneralRe: Someone please help me .... Pin
CPallini16-Sep-08 2:30
mveCPallini16-Sep-08 2:30 
GeneralRe: Someone please help me .... Pin
geoffs12-Sep-08 5:32
geoffs12-Sep-08 5:32 
GeneralRe: Someone please help me .... Pin
BillW3312-Sep-08 6:16
professionalBillW3312-Sep-08 6:16 

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.