Click here to Skip to main content
15,909,030 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: help pls Pin
Luc Pattyn11-Nov-07 10:42
sitebuilderLuc Pattyn11-Nov-07 10:42 
GeneralRe: help pls Pin
Pete O'Hanlon11-Nov-07 23:23
mvePete O'Hanlon11-Nov-07 23:23 
GeneralRe: help pls Pin
BadKarma13-Nov-07 1:56
BadKarma13-Nov-07 1:56 
GeneralRe: help pls Pin
Ri Qen-Sin13-Nov-07 1:16
Ri Qen-Sin13-Nov-07 1:16 
JokeRe: help pls Pin
Vasudevan Deepak Kumar14-Nov-07 1:30
Vasudevan Deepak Kumar14-Nov-07 1:30 
GeneralRe: help pls Pin
Justin Perez14-Nov-07 4:27
Justin Perez14-Nov-07 4:27 
AnswerRe: here's how to use quantum crypto in VB Pin
NimitySSJ29-Nov-07 20:34
NimitySSJ29-Nov-07 20:34 
QuestionWhat's the best way to do conditional compile? Pin
crewchill8-Nov-07 8:04
crewchill8-Nov-07 8:04 
I hate posting this, since probably 85% of general population actually love using #if and #ifdef and even see that's the only easy way to do "cross-platform". I don't, BTW.

Here is my gripe.

One #if is fine. Nested #if is nasty (I've seen #if else nested 8 level deep, with structures whose definition has more #if in it).

Problem is #if begets another #if. I work in a company that has at least 90 conditional compile flags set into either makefile or command line. BTW, my Unix terminal has to scroll 4 pages for the complete build commands (and yes, mostly are the -D define flag). The worst part is the flags are peppered all over the code, maybe 2 millions LOC. And nobody bothers to consolidate them.

I've seen a Linux distro that has parts of files that is different between platform stored in different directory. I couldn't remember what the Linux flavor was. They choose between target sources in makefile, instead of in the code. And the differences are stored in different dirs for ex. /x86 /alpha /risc, and these files have exactly same files with different content.

I think this is a much more cleaner and maintainable approach. The key is to identify what would be different and consolidate it in one area.

Any other ideas?


AnswerRe: What's the best way to do conditional compile? Pin
Pete O'Hanlon8-Nov-07 9:19
mvePete O'Hanlon8-Nov-07 9:19 
AnswerRe: What's the best way to do conditional compile? Pin
KarstenK9-Nov-07 3:13
mveKarstenK9-Nov-07 3:13 
AnswerRe: What's the best way to do conditional compile? Pin
Saksida Bojan9-Nov-07 7:04
Saksida Bojan9-Nov-07 7:04 
AnswerRe: What's the best way to do conditional compile? Pin
Mike Dimmick12-Nov-07 5:21
Mike Dimmick12-Nov-07 5:21 
AnswerRe: What's the best way to do conditional compile? Pin
earl the dead cat12-Nov-07 7:39
earl the dead cat12-Nov-07 7:39 
GeneralRe: What's the best way to do conditional compile? Pin
crewchill12-Nov-07 7:55
crewchill12-Nov-07 7:55 
AnswerRe: What's the best way to do conditional compile? Pin
Philip Laureano14-Nov-07 4:38
Philip Laureano14-Nov-07 4:38 
AnswerRe: by avoiding it... Pin
NimitySSJ29-Nov-07 20:40
NimitySSJ29-Nov-07 20:40 
QuestionHow to code complicated actuarial formulas in C#?! Pin
k3n3dy7-Nov-07 10:07
k3n3dy7-Nov-07 10:07 
AnswerRe: How to code complicated actuarial formulas in C#?! Pin
Pete O'Hanlon7-Nov-07 11:17
mvePete O'Hanlon7-Nov-07 11:17 
GeneralRe: How to code complicated actuarial formulas in C#?! Pin
_Damian S_7-Nov-07 12:04
professional_Damian S_7-Nov-07 12:04 
GeneralRe: How to code complicated actuarial formulas in C#?! Pin
jg_8-Nov-07 4:24
jg_8-Nov-07 4:24 
JokeRe: How to code complicated actuarial formulas in C#?! Pin
Vasudevan Deepak Kumar8-Nov-07 21:30
Vasudevan Deepak Kumar8-Nov-07 21:30 
GeneralRe: How to code complicated actuarial formulas in C#?! Pin
jg_9-Nov-07 1:49
jg_9-Nov-07 1:49 
AnswerRe: How to code complicated actuarial formulas in C#?! Pin
_Damian S_7-Nov-07 12:03
professional_Damian S_7-Nov-07 12:03 
AnswerRe: How to code complicated actuarial formulas in C#?! Pin
KarstenK8-Nov-07 1:06
mveKarstenK8-Nov-07 1:06 
GeneralRe: How to code complicated actuarial formulas in C#?! Pin
Pete O'Hanlon8-Nov-07 1:41
mvePete O'Hanlon8-Nov-07 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.