Click here to Skip to main content
14,269,640 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: IF-free codes Pin
dusty_dex19-Feb-13 5:54
memberdusty_dex19-Feb-13 5:54 
GeneralRe: IF-free codes Pin
DarthDana19-Mar-13 10:09
professionalDarthDana19-Mar-13 10:09 
GeneralRe: IF-free codes Pin
RonDsz19-Feb-13 9:36
memberRonDsz19-Feb-13 9:36 
JokeRe: IF-free codes Pin
Brisingr Aerowing25-Feb-13 14:58
professionalBrisingr Aerowing25-Feb-13 14:58 
GeneralRe: IF-free codes Pin
PIEBALDconsult15-Feb-13 19:27
protectorPIEBALDconsult15-Feb-13 19:27 
JokeRe: IF-free codes Pin
Brisingr Aerowing15-Feb-13 19:47
professionalBrisingr Aerowing15-Feb-13 19:47 
GeneralRe: IF-free codes Pin
Monaco.Bavarian18-Feb-13 19:50
memberMonaco.Bavarian18-Feb-13 19:50 
GeneralRe: IF-free codes Pin
KP Lee19-Feb-13 11:36
memberKP Lee19-Feb-13 11:36 
Monaco.Bavarian wrote:
you are a winner of obfuscated C contest

Thanks, I generally dislike reading C++ because its nature seems to be obfuscated = better.
That one was so hard to read, I couldn't understand the point. From comments it looks like the point is that using if tests to branch to another location is a bad practice.
Everything I've read leads to not using spagetti code. IE branching is good.
I just read an article about bubble sorting and someone reading the article believing it was efficient. I was just going to leave the article thinking it was written by a beginner, leave him alone, but when a reader believes it is efficient. I couldn't just drop it. On initial tests, just 200K takes over 2.5 minutes. I calculated 20M would take 70 weeks. I built a less readable set of code that sorts 50M records in 14+ seconds.

Less readable = much greater efficiency to me is a good thing. (At least when comparing weeks to seconds.) I didn't see the benefit of his code in the article.
AnswerRe: IF-free codes Pin
Monaco.Bavarian19-Feb-13 19:07
memberMonaco.Bavarian19-Feb-13 19:07 
GeneralRe: IF-free codes Pin
KP Lee19-Feb-13 21:51
memberKP Lee19-Feb-13 21:51 
GeneralRe: IF-free codes Pin
Stefan_Lang19-Feb-13 0:30
memberStefan_Lang19-Feb-13 0:30 
GeneralRe: IF-free codes Pin
JHubSharp19-Feb-13 4:14
memberJHubSharp19-Feb-13 4:14 
GeneralRe: IF-free codes Pin
Gary Huck19-Feb-13 5:19
memberGary Huck19-Feb-13 5:19 
GeneralRe: IF-free codes Pin
Zan Lynx19-Feb-13 11:10
memberZan Lynx19-Feb-13 11:10 
GeneralRe: IF-free codes Pin
5urd19-Feb-13 6:01
member5urd19-Feb-13 6:01 
GeneralRe: IF-free codes Pin
Dave Kreskowiak5-Mar-13 3:55
mveDave Kreskowiak5-Mar-13 3:55 
GeneralRe: IF-free codes Pin
RafagaX19-Feb-13 6:22
professionalRafagaX19-Feb-13 6:22 
GeneralRe: IF-free codes Pin
jschell19-Feb-13 8:16
memberjschell19-Feb-13 8:16 
GeneralRe: IF-free codes Pin
Josh_T19-Feb-13 13:40
memberJosh_T19-Feb-13 13:40 
GeneralRe: IF-free codes Pin
Member 460889823-Feb-13 7:07
memberMember 460889823-Feb-13 7:07 
GeneralRe: IF-free codes Pin
Ingo26-Feb-13 4:23
memberIngo26-Feb-13 4:23 
GeneralRe: IF-free codes Pin
SarK0Y28-Oct-14 12:13
memberSarK0Y28-Oct-14 12:13 
GeneralRe: IF-free codes Pin
Ingo28-Oct-14 23:20
memberIngo28-Oct-14 23:20 
QuestionRe: IF-free codes Pin
SarK0Y29-Oct-14 9:16
memberSarK0Y29-Oct-14 9:16 
AnswerRe: IF-free codes Pin
Ingo31-Oct-14 1:41
memberIngo31-Oct-14 1:41 

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.