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

 
AnswerRe: accidental deletion Pin
Gary Wheeler1-Nov-12 6:13
Gary Wheeler1-Nov-12 6:13 
GeneralRe: Now this is embarassing Pin
Martin.Cheng1-Nov-12 23:32
Martin.Cheng1-Nov-12 23:32 
GeneralIs silly bad? PinPopular
Stefan_Lang25-Oct-12 22:53
Stefan_Lang25-Oct-12 22:53 
GeneralRe: Is silly bad? Pin
BobJanova25-Oct-12 22:58
BobJanova25-Oct-12 22:58 
GeneralRe: Is silly bad? Pin
peterchen25-Oct-12 23:37
peterchen25-Oct-12 23:37 
GeneralRe: Is silly bad? Pin
Stefan_Lang26-Oct-12 0:56
Stefan_Lang26-Oct-12 0:56 
GeneralRe: Is silly bad? Pin
BobJanova26-Oct-12 1:01
BobJanova26-Oct-12 1:01 
GeneralRe: Is silly bad? Pin
Stefan_Lang26-Oct-12 1:53
Stefan_Lang26-Oct-12 1:53 
I hear you, and I agree. But, unfortunately, equating TRUE to 0 is not so uncommon as you might think. Just think of the exit code: A value of 0 is generally considered as success...

20 years ago, you simply couldn't rely on TRUE to be 0 or 1 or -1 - you had to either check the definition, or just make a safe test to ensure that your code will still work, no matter what the typedef:
C++
if (b == TRUE)
 ...

This would work, even if the values of TRUE and FALSE were changed later. And that was a very real possibility at those times! I made it a habit to code like that, because I needed to! Needless to say, I was very relieved when the type bool was finally introduced!
GeneralRe: Is silly bad? Pin
BobJanova26-Oct-12 2:34
BobJanova26-Oct-12 2:34 
GeneralRe: Is silly bad? Pin
Stefan_Lang26-Oct-12 3:51
Stefan_Lang26-Oct-12 3:51 
GeneralRe: Is silly bad? Pin
Paulo Zemek30-Oct-12 4:43
Paulo Zemek30-Oct-12 4:43 
GeneralRe: Is silly bad? Pin
BlackMilan29-Oct-12 23:09
BlackMilan29-Oct-12 23:09 
GeneralRe: Is silly bad? Pin
Stefan_Lang30-Oct-12 0:13
Stefan_Lang30-Oct-12 0:13 
GeneralRe: Is silly bad? Pin
goodsport30-Oct-12 15:41
goodsport30-Oct-12 15:41 
GeneralRe: Is silly bad? Pin
Member 460889831-Oct-12 21:20
Member 460889831-Oct-12 21:20 
GeneralRe: Is silly bad? Pin
Paulo Zemek30-Oct-12 3:23
Paulo Zemek30-Oct-12 3:23 
GeneralRe: Is silly bad? Pin
Fabio Franco30-Oct-12 10:43
professionalFabio Franco30-Oct-12 10:43 
GeneralRe: Is silly bad? Pin
lucien6431-Oct-12 5:13
professionallucien6431-Oct-12 5:13 
GeneralA very terrifying stored procedure: how can you solve this issue really ??? PinPopular
devenv.exe24-Oct-12 20:07
professionaldevenv.exe24-Oct-12 20:07 
GeneralRe: A very terrifying stored procedure: how can you solve this issue really ??? Pin
HaBiX24-Oct-12 20:29
HaBiX24-Oct-12 20:29 
GeneralRe: A very terrifying stored procedure: how can you solve this issue really ??? Pin
devenv.exe24-Oct-12 20:32
professionaldevenv.exe24-Oct-12 20:32 
GeneralRe: A very terrifying stored procedure: how can you solve this issue really ??? Pin
OriginalGriff24-Oct-12 21:32
mveOriginalGriff24-Oct-12 21:32 
GeneralRe: A very terrifying stored procedure: how can you solve this issue really ??? Pin
fjdiewornncalwe25-Oct-12 3:00
professionalfjdiewornncalwe25-Oct-12 3:00 
GeneralRe: A very terrifying stored procedure: how can you solve this issue really ??? Pin
BobJanova24-Oct-12 22:22
BobJanova24-Oct-12 22:22 
JokeRe: A very terrifying stored procedure: how can you solve this issue really ??? Pin
ZurdoDev25-Oct-12 2:03
professionalZurdoDev25-Oct-12 2:03 

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.