Click here to Skip to main content
15,887,135 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: Why do engineers insist on complexity? Pin
0bx6-Dec-12 7:00
0bx6-Dec-12 7:00 
GeneralRe: Why do engineers insist on complexity? Pin
Frans_551295-Dec-12 1:04
Frans_551295-Dec-12 1:04 
GeneralRe: Why do engineers insist on complexity? Pin
BobJanova5-Dec-12 1:22
BobJanova5-Dec-12 1:22 
GeneralRe: Why do engineers insist on complexity? Pin
Roger1655-Dec-12 2:26
Roger1655-Dec-12 2:26 
GeneralRe: Why do engineers insist on complexity? Pin
RafagaX5-Dec-12 5:03
professionalRafagaX5-Dec-12 5:03 
GeneralRe: Why do engineers insist on complexity? Pin
Member 45591065-Dec-12 6:00
Member 45591065-Dec-12 6:00 
GeneralRe: Why do engineers insist on complexity? Pin
patbob5-Dec-12 6:04
patbob5-Dec-12 6:04 
GeneralRe: Why do engineers insist on complexity? Pin
Freak305-Dec-12 22:45
Freak305-Dec-12 22:45 
If the number 4 was used somewhere else in the function (e.g. in the condition of a loop), I would have defined a const int fieldSize = 4; or something like that before the first usage. In the improbable case that the number needs to be increased, it avoids the trap of changing it only in one place and then having to look for the occasionally occurring error.

Regarding allocation on the stack I had an embarassing moment myself last week. I had created an object on the stack (didn't test how large it was), and it worked fine in debug mode. In release mode it crashed somewhere. Took some time and usage of several message boxes to find out the crash occurred in the moment the function containing the object was called. Then it dawned to me that I had stumbeld across this same problem some years ago in a different place. The stackzize was smaller in release mode. Roll eyes | :rolleyes: I needed to allocate that object on the heap, and voilá it worked.
GeneralRe: Why do engineers insist on complexity? Pin
Nemanja Trifunovic8-Dec-12 3:08
Nemanja Trifunovic8-Dec-12 3:08 
GeneralLocalization is great Pin
Bernhard Hiller29-Nov-12 21:53
Bernhard Hiller29-Nov-12 21:53 
GeneralRe: Localization is great Pin
Brisingr Aerowing30-Nov-12 4:13
professionalBrisingr Aerowing30-Nov-12 4:13 
GeneralTry/catch block... PinPopular
Thomas Daniels18-Nov-12 3:28
mentorThomas Daniels18-Nov-12 3:28 
GeneralRe: Try/catch block... PinPopular
RugbyLeague18-Nov-12 3:57
RugbyLeague18-Nov-12 3:57 
GeneralRe: Try/catch block... Pin
Thomas Daniels18-Nov-12 3:59
mentorThomas Daniels18-Nov-12 3:59 
GeneralRe: Try/catch block... Pin
_Vitor Garcia_21-Nov-12 3:31
_Vitor Garcia_21-Nov-12 3:31 
GeneralRe: Try/catch block... Pin
Mark_Wallace19-Nov-12 1:19
Mark_Wallace19-Nov-12 1:19 
GeneralRe: Try/catch block... Pin
Thomas Daniels20-Nov-12 6:26
mentorThomas Daniels20-Nov-12 6:26 
GeneralRe: Try/catch block... Pin
Brisingr Aerowing20-Nov-12 11:45
professionalBrisingr Aerowing20-Nov-12 11:45 
JokeRe: Try/catch block... PinPopular
Bernhard Hiller19-Nov-12 22:56
Bernhard Hiller19-Nov-12 22:56 
GeneralRe: Try/catch block... PinPopular
Richard Deeming20-Nov-12 1:37
mveRichard Deeming20-Nov-12 1:37 
GeneralRe: Try/catch block... Pin
Bernhard Hiller20-Nov-12 4:36
Bernhard Hiller20-Nov-12 4:36 
GeneralRe: Try/catch block... Pin
acomputerdog21-Nov-12 2:16
professionalacomputerdog21-Nov-12 2:16 
GeneralRe: Try/catch block... Pin
Richard Deeming21-Nov-12 2:23
mveRichard Deeming21-Nov-12 2:23 
GeneralRe: Try/catch block... Pin
acomputerdog21-Nov-12 2:27
professionalacomputerdog21-Nov-12 2:27 
GeneralRe: Try/catch block... Pin
Reese Currie21-Nov-12 2:52
Reese Currie21-Nov-12 2:52 

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.