Click here to Skip to main content
12,998,712 members (118,730 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: Would you like to buy an IsNull ? Pin
PIEBALDconsult5-Dec-12 9:31
memberPIEBALDconsult5-Dec-12 9:31 
GeneralRe: Would you like to buy an IsNull ? Pin
AspDotNetDev5-Dec-12 10:07
protectorAspDotNetDev5-Dec-12 10:07 
GeneralRe: Would you like to buy an IsNull ? Pin
PIEBALDconsult5-Dec-12 12:10
memberPIEBALDconsult5-Dec-12 12:10 
GeneralRe: Would you like to buy an IsNull ? Pin
d@nish 5-Dec-12 21:06
member d@nish 5-Dec-12 21:06 
GeneralRe: Would you like to buy an IsNull ? Pin
KP Lee5-Dec-12 12:36
memberKP Lee5-Dec-12 12:36 
GeneralRe: Would you like to buy an IsNull ? Pin
PIEBALDconsult5-Dec-12 13:11
memberPIEBALDconsult5-Dec-12 13:11 
GeneralRe: Would you like to buy an IsNull ? Pin
Jörgen Andersson6-Dec-12 21:12
memberJörgen Andersson6-Dec-12 21:12 
GeneralWhy do engineers insist on complexity? Pin
Joe Woodbury4-Dec-12 7:33
memberJoe Woodbury4-Dec-12 7:33 
A few years ago, I was working on some very legacy code that required a temporary array in a function. The array size would never, ever change and could be hard coded.

The legacy code:

char* pData = new char[4];
//Do stuff
delete[] pData;


When I mentioned this recently to a colleague, he said that a smart pointer should have been used. Today that would be:

std::unique_ptr<char> pData = new char[4];
//Do stuff


Last week, I ran across a web site discussing optimizations that a similar concept, though with more items. Applied to the legacy code, this this "expert's" solution was:

std::vector<char> data(4);
//Do stuff


Why not just my solution:

char data[4];
//Do stuff


Have people gotten so accustomed to complexity that they think of only complex solutions?

(I have other examples, the second funniest was when someone suggested using a boost function instead of three lines of elementary C code.)
GeneralRe: Why do engineers insist on complexity? Pin
Andrew Rissing4-Dec-12 8:11
memberAndrew Rissing4-Dec-12 8:11 
JokeRe: Why do engineers insist on complexity? Pin
Zac Greve4-Dec-12 8:12
memberZac Greve4-Dec-12 8:12 
GeneralRe: Why do engineers insist on complexity? Pin
Chris Meech4-Dec-12 9:10
memberChris Meech4-Dec-12 9:10 
GeneralRe: Why do engineers insist on complexity? Pin
YvesDaoust4-Dec-12 20:57
memberYvesDaoust4-Dec-12 20:57 
GeneralRe: Why do engineers insist on complexity? Pin
SeattleC++5-Dec-12 7:00
memberSeattleC++5-Dec-12 7:00 
GeneralRe: Why do engineers insist on complexity? Pin
Fran Porretto5-Dec-12 0:50
memberFran Porretto5-Dec-12 0:50 
GeneralRe: Why do engineers insist on complexity? Pin
PSM_300E5-Dec-12 2:16
memberPSM_300E5-Dec-12 2:16 
GeneralRe: Why do engineers insist on complexity? Pin
Fran Porretto5-Dec-12 2:17
memberFran Porretto5-Dec-12 2:17 
GeneralRe: Why do engineers insist on complexity? Pin
PSM_300E5-Dec-12 2:19
memberPSM_300E5-Dec-12 2:19 
GeneralRe: Why do engineers insist on complexity? Pin
Mark H25-Dec-12 8:13
memberMark H25-Dec-12 8:13 
GeneralRe: Why do engineers insist on complexity? Pin
BC @ CV5-Dec-12 5:05
memberBC @ CV5-Dec-12 5:05 
GeneralRe: Why do engineers insist on complexity? Pin
SeattleC++5-Dec-12 7:12
memberSeattleC++5-Dec-12 7:12 
GeneralRe: Why do engineers insist on complexity? Pin
Fran Porretto5-Dec-12 7:31
memberFran Porretto5-Dec-12 7:31 
GeneralRe: Why do engineers insist on complexity? Pin
satovey5-Dec-12 11:16
membersatovey5-Dec-12 11:16 
GeneralRe: Why do engineers insist on complexity? Pin
Fran Porretto6-Dec-12 0:28
memberFran Porretto6-Dec-12 0:28 
GeneralRe: Why do engineers insist on complexity? Pin
0bx6-Dec-12 7:00
member0bx6-Dec-12 7:00 
GeneralRe: Why do engineers insist on complexity? Pin
Frans_551295-Dec-12 1:04
memberFrans_551295-Dec-12 1:04 

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