Click here to Skip to main content
12,945,706 members (47,745 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
BobJanova13-Jun-13 0:54
memberBobJanova13-Jun-13 0:54 
GeneralRe: Bug of the day Pin
Gary Wheeler13-Jun-13 1:08
memberGary Wheeler13-Jun-13 1:08 
GeneralRe: Bug of the day Pin
BobJanova13-Jun-13 2:12
memberBobJanova13-Jun-13 2:12 
GeneralRe: Bug of the day Pin
Cornelius Henning13-Jun-13 4:13
memberCornelius Henning13-Jun-13 4:13 
GeneralRe: Bug of the day Pin
Gary Wheeler13-Jun-13 4:21
memberGary Wheeler13-Jun-13 4:21 
GeneralRe: Bug of the day Pin
cjb11020-Jun-13 2:37
membercjb11020-Jun-13 2:37 
GeneralRe: Bug of the day Pin
Gary Wheeler24-Jun-13 0:21
memberGary Wheeler24-Jun-13 0:21 
GeneralRe: Bug of the day Pin
StatementTerminator13-Jun-13 5:21
memberStatementTerminator13-Jun-13 5:21 
Gary Wheeler wrote:
if condition then
DoThing1();
DoThing2();
DoThing3();
MainStuff();


Yeah that's one of my all-time favorites. It usually starts out like:

if(condition)
    DoThing1();


And then someone comes along later and adds DoThing2(), and the compiler silently chuckles to itself and lets the code do a lot of Thing2.

Personally, I like to always use curly braces to block off code for that very reason, even if it's only one statement. If I see something like that with one statement, I'll add the braces so it's clear when someone comes along and changes it.

Putting it all on one line works fine as well, but I like to always create a code block because it makes it easier to add statements later. And really, what's the point of keeping it on one line? But I know a lot of programmers have an irrational fear of vertical space Smile | :)
JokeRe: Bug of the day Pin
Bernhard Hiller12-Jun-13 21:27
professionalBernhard Hiller12-Jun-13 21:27 
GeneralRe: Bug of the day Pin
R. Erasmus12-Jun-13 21:38
memberR. Erasmus12-Jun-13 21:38 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 1:21
memberFabio Franco13-Jun-13 1:21 
GeneralRe: Bug of the day Pin
gervacleto13-Jun-13 2:24
membergervacleto13-Jun-13 2:24 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 2:54
memberFabio Franco13-Jun-13 2:54 
GeneralRe: Bug of the day Pin
gervacleto13-Jun-13 3:45
membergervacleto13-Jun-13 3:45 
GeneralRe: Bug of the day Pin
Pablo Aliskevicius13-Jun-13 3:53
memberPablo Aliskevicius13-Jun-13 3:53 
GeneralRe: Bug of the day Pin
StatementTerminator13-Jun-13 5:40
memberStatementTerminator13-Jun-13 5:40 
GeneralRe: Bug of the day Pin
Fabio Franco13-Jun-13 3:54
memberFabio Franco13-Jun-13 3:54 
GeneralRe: Bug of the day Pin
MainFrameMan_ALIVE_AND_WELL$$13-Jun-13 4:32
memberMainFrameMan_ALIVE_AND_WELL$$13-Jun-13 4:32 
GeneralRe: Bug of the day Pin
RafagaX13-Jun-13 5:31
memberRafagaX13-Jun-13 5:31 
GeneralRe: Bug of the day Pin
Adam David Hill14-Jun-13 5:26
memberAdam David Hill14-Jun-13 5:26 
GeneralRe: Bug of the day Pin
Marc Clifton18-Jun-13 5:32
protectorMarc Clifton18-Jun-13 5:32 
GeneralProductivity Wars Pin
jim lahey7-Jun-13 4:42
memberjim lahey7-Jun-13 4:42 
GeneralRe: Productivity Wars Pin
BobJanova7-Jun-13 4:57
memberBobJanova7-Jun-13 4:57 
GeneralRe: Productivity Wars Pin
jim lahey7-Jun-13 5:04
memberjim lahey7-Jun-13 5:04 
GeneralRe: Productivity Wars Pin
R. Erasmus11-Jun-13 3:28
memberR. Erasmus11-Jun-13 3:28 

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 | Mobile
Web01 | 2.8.170518.1 | Last Updated 23 May 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid