Click here to Skip to main content
15,890,438 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: Premature Disposal - The Sequel Pin
Rob Grainger6-Feb-08 5:56
Rob Grainger6-Feb-08 5:56 
GeneralRe: Premature Disposal - The Sequel Pin
PIEBALDconsult6-Feb-08 7:22
mvePIEBALDconsult6-Feb-08 7:22 
GeneralRe: Premature Disposal - The Sequel Pin
TheGreatAndPowerfulOz8-Feb-08 7:29
TheGreatAndPowerfulOz8-Feb-08 7:29 
GeneralRe: Premature Disposal Pin
Brady Kelly6-Feb-08 7:48
Brady Kelly6-Feb-08 7:48 
GeneralRe: Premature Disposal Pin
Thomas R. Wolfe7-Feb-08 0:34
Thomas R. Wolfe7-Feb-08 0:34 
GeneralRe: Premature Disposal Pin
Nemanja Trifunovic7-Feb-08 5:53
Nemanja Trifunovic7-Feb-08 5:53 
GeneralRe: Premature Disposal Pin
TheGreatAndPowerfulOz8-Feb-08 7:26
TheGreatAndPowerfulOz8-Feb-08 7:26 
GeneralRewriting CString Pin
Member 45277484-Feb-08 2:58
Member 45277484-Feb-08 2:58 
I found this moving a project from visual studio 2003 to 2005.

void RemoveChars(CString& Str, const char* pChar)
{
int iLen = Str.GetLength();
if ( !iLen )
return;

char* szStr=Str.GetBuffer(iLen);
ASSERT(szStr);

WORD iDest;
WORD iSrc;

iDest=(WORD)::strcspn(szStr, pChar);

while( iDest != ::strlen(szStr) )
{
iSrc = (WORD)::strspn(szStr+iDest,pChar);

if( iSrc )
{
::strcpy_s(szStr + iDest, iLen, szStr + iSrc + iDest);
}
else
{
*(szStr+iDest) = '\0';
}

iDest=(WORD)::strcspn(szStr, pChar);
} // while

Str.ReleaseBuffer();
}
GeneralUNUSED functions Pin
Delphi4ever1-Feb-08 2:50
Delphi4ever1-Feb-08 2:50 
GeneralRe: UNUSED functions Pin
Maximilien1-Feb-08 3:21
Maximilien1-Feb-08 3:21 
GeneralRe: UNUSED functions Pin
Delphi4ever1-Feb-08 3:52
Delphi4ever1-Feb-08 3:52 
GeneralRe: UNUSED functions Pin
BadKarma1-Feb-08 4:08
BadKarma1-Feb-08 4:08 
GeneralRe: UNUSED functions Pin
CPallini1-Feb-08 4:14
mveCPallini1-Feb-08 4:14 
GeneralRe: UNUSED functions Pin
DRHuff5-Feb-08 9:21
DRHuff5-Feb-08 9:21 
GeneralRe: UNUSED functions Pin
CPallini1-Feb-08 4:12
mveCPallini1-Feb-08 4:12 
GeneralRe: UNUSED functions Pin
Maximilien1-Feb-08 4:14
Maximilien1-Feb-08 4:14 
GeneralRe: UNUSED functions Pin
John R. Shaw1-Feb-08 23:24
John R. Shaw1-Feb-08 23:24 
GeneralRe: UNUSED functions Pin
Dan Neely4-Feb-08 2:52
Dan Neely4-Feb-08 2:52 
GeneralRe: UNUSED functions Pin
Cristian Amarie3-Feb-08 21:38
Cristian Amarie3-Feb-08 21:38 
GeneralRe: UNUSED functions Pin
Mike Diack4-Feb-08 10:01
Mike Diack4-Feb-08 10:01 
GeneralInformative Comments Pin
ClementsDan31-Jan-08 14:51
ClementsDan31-Jan-08 14:51 
QuestionRe: Informative Comments Pin
CPallini1-Feb-08 1:18
mveCPallini1-Feb-08 1:18 
GeneralRe: Informative Comments Pin
ClementsDan6-Feb-08 12:15
ClementsDan6-Feb-08 12:15 
GeneralRe: Informative Comments Pin
CARPETBURNER1-Feb-08 2:24
CARPETBURNER1-Feb-08 2:24 
GeneralRe: Informative Comments PinPopular
CPallini1-Feb-08 2:30
mveCPallini1-Feb-08 2:30 

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.