Click here to Skip to main content
15,887,027 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 String.Format? Pin
SoMad15-Jun-12 13:34
professionalSoMad15-Jun-12 13:34 
GeneralRe: Why String.Format? PinPopular
Sander Rossel15-Jun-12 21:19
professionalSander Rossel15-Jun-12 21:19 
GeneralRe: Why String.Format? Pin
SoMad15-Jun-12 21:30
professionalSoMad15-Jun-12 21:30 
GeneralRe: Why String.Format? Pin
Sander Rossel15-Jun-12 21:46
professionalSander Rossel15-Jun-12 21:46 
GeneralRe: Why String.Format? Pin
FireDog3126218-Jun-12 3:17
FireDog3126218-Jun-12 3:17 
GeneralRe: Why String.Format? Pin
Moshe Katz18-Jun-12 4:33
Moshe Katz18-Jun-12 4:33 
GeneralRe: Why String.Format? Pin
KP Lee18-Jun-12 20:39
KP Lee18-Jun-12 20:39 
GeneralRe: Why String.Format? PinPopular
jhunley15-Jun-12 17:38
jhunley15-Jun-12 17:38 
I've been maintaining a C++ codebase for several years now that has this type of thing all through it:

C++
if (someErrorCondition)
{
   char *msg = "Error 404\n";
   char s[100];
   sprintf(s, "%s", msg);
   PrintErrorMessage(s);
}


as opposed to just:

C++
if (someErrorCondition)
   PrintErrorMessage("Error 404\n");


And this was in an embedded system, where they were constantly having to eliminate features because they had exceeded the limited code space or overflowed the stack!
GeneralRe: Why String.Format? Pin
JackDingler19-Jun-12 9:53
JackDingler19-Jun-12 9:53 
GeneralRe: Why String.Format? Pin
RobCroll17-Jun-12 5:25
RobCroll17-Jun-12 5:25 
GeneralRe: Why String.Format? Pin
FireDog3126218-Jun-12 3:20
FireDog3126218-Jun-12 3:20 
JokeRe: Why String.Format? Pin
Rahul Rajat Singh26-Jun-12 1:01
professionalRahul Rajat Singh26-Jun-12 1:01 
GeneralTry Fail... PinPopular
VallarasuS15-Jun-12 2:22
VallarasuS15-Jun-12 2:22 
GeneralRe: Try Fail... Pin
CDP180215-Jun-12 2:40
CDP180215-Jun-12 2:40 
GeneralRe: Try Fail... Pin
BobJanova15-Jun-12 4:53
BobJanova15-Jun-12 4:53 
GeneralRe: Try Fail... Pin
CDP180215-Jun-12 5:08
CDP180215-Jun-12 5:08 
GeneralRe: Try Fail... Pin
Julien Villers15-Jun-12 3:33
professionalJulien Villers15-Jun-12 3:33 
GeneralRe: Try Fail... Pin
VallarasuS15-Jun-12 5:15
VallarasuS15-Jun-12 5:15 
GeneralRe: Try Fail... Pin
Julien Villers15-Jun-12 5:18
professionalJulien Villers15-Jun-12 5:18 
GeneralRe: Try Fail... Pin
Richard Deeming18-Jun-12 10:18
mveRichard Deeming18-Jun-12 10:18 
GeneralRe: Try Fail... Pin
KP Lee18-Jun-12 21:55
KP Lee18-Jun-12 21:55 
GeneralWhy use String.Concat() ? Pin
CoperNick13-Jun-12 3:04
CoperNick13-Jun-12 3:04 
GeneralRe: Why use String.Concat() ? PinPopular
CoperNick13-Jun-12 3:08
CoperNick13-Jun-12 3:08 
GeneralRe: Why use String.Concat() ? PinPopular
StM0n13-Jun-12 5:59
StM0n13-Jun-12 5:59 
GeneralRe: Why use String.Concat() ? PinPopular
leppie14-Jun-12 1:55
leppie14-Jun-12 1:55 

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.