Click here to Skip to main content
15,887,373 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
Fran Porretto6-Dec-12 0:28
Fran Porretto6-Dec-12 0:28 
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 
We write more code with more complexity because languages have gotten more complex over the years, and also because we've been educated to more forms of complexity. Those various solutions deal with that complexity better.

Simple new/delete isn't the safest solution in an operator-overloaded, exception-throwing world. The smart pointer solves that issue transparently (although I'm not sure whether it deletes a single character of the array, or the entire array).

The vector<> solution allows a wider range of primatives to be used against the array, in addition to being leak-safe like the smart pointer and guaranteed to call the array version of delete.

The stack solution is probably the best, and what I would opt for, if I knew I'd never need to use any of the STL primatives on it. Besides, it doesn't run any risk of memory fragmentation like ALL of the other solutions do Smile | :)
We can program with only 1's, but if all you've got are zeros, you've got nothing.

GeneralRe: Why do engineers insist on complexity? Pin
Freak305-Dec-12 22:45
Freak305-Dec-12 22:45 
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 

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.