Click here to Skip to main content
15,899,754 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: Practice safe programming ! Pin
Anand Desai12-Aug-08 23:28
Anand Desai12-Aug-08 23:28 
GeneralRe: Practice safe programming ! Pin
Nemanja Trifunovic13-Aug-08 7:18
Nemanja Trifunovic13-Aug-08 7:18 
GeneralRe: Practice safe programming ! Pin
Kevin McFarlane13-Aug-08 9:49
Kevin McFarlane13-Aug-08 9:49 
GeneralRe: Practice safe programming ! Pin
Nemanja Trifunovic13-Aug-08 10:59
Nemanja Trifunovic13-Aug-08 10:59 
GeneralRe: Practice safe programming ! Pin
Yusuf13-Aug-08 15:24
Yusuf13-Aug-08 15:24 
GeneralRe: Practice safe programming ! Pin
Jörgen Sigvardsson22-Aug-08 10:23
Jörgen Sigvardsson22-Aug-08 10:23 
GeneralRe: Practice safe programming ! Pin
geoffs14-Aug-08 9:23
geoffs14-Aug-08 9:23 
GeneralRe: Practice safe programming ! Pin
Johann Gerell21-Aug-08 1:11
Johann Gerell21-Aug-08 1:11 
Nemanja Trifunovic wrote:
Somewhat off topic: Never understood the people who allocate objects on heap when it is easier and safer to do it on stack.


In the general case, you are absolutely spot on. Also, never use pointer arguments to functions unless 0/NULL is a valid value for input.

But, but, but... consider the case when an instance of CYesNoDlgBar eats too much stack by itself, and can therefore only be created on the heap? [1]

Not that I actually think that was the case there...

[1] I've actually just some moments ago fixed the GIF parts of CxImage to be usable on a handheld device platform, where the default stack is just roughly a handful of 10 KB, because several member arrays of the CxImageGIF were harcoded to sizes accumulating to way above the available stack, causing runtime failures. Using std::vector<> solved it.

--
Time you enjoy wasting is not wasted time - Bertrand Russel

GeneralRe: Practice safe programming ! Pin
Paul Conrad13-Aug-08 9:27
professionalPaul Conrad13-Aug-08 9:27 
GeneralRe: Practice safe programming ! Pin
KarstenK14-Aug-08 3:48
mveKarstenK14-Aug-08 3:48 
GeneralRe: Practice safe programming ! Pin
Paul Conrad14-Aug-08 6:21
professionalPaul Conrad14-Aug-08 6:21 
GeneralCalling a subroutine Pin
Timothy Baldwin12-Aug-08 11:34
Timothy Baldwin12-Aug-08 11:34 
GeneralRe: Calling a subroutine Pin
Chris Maunder12-Aug-08 16:42
cofounderChris Maunder12-Aug-08 16:42 
GeneralRe: Calling a subroutine Pin
Mike Dimmick17-Aug-08 10:39
Mike Dimmick17-Aug-08 10:39 
GeneralRe: Calling a subroutine Pin
Timothy Baldwin21-Aug-08 5:14
Timothy Baldwin21-Aug-08 5:14 
GeneralRe: Calling a subroutine Pin
supercat917-Aug-08 11:59
supercat917-Aug-08 11:59 
GeneralCode which caused my PC hang [modified] PinPopular
Anand Desai6-Aug-08 22:41
Anand Desai6-Aug-08 22:41 
GeneralRe: Code which caused my PC hang PinPopular
leppie7-Aug-08 1:35
leppie7-Aug-08 1:35 
GeneralRe: Code which caused my PC hang Pin
Anand Desai7-Aug-08 2:14
Anand Desai7-Aug-08 2:14 
GeneralRe: Code which caused my PC hang Pin
leppie7-Aug-08 2:19
leppie7-Aug-08 2:19 
GeneralRe: Code which caused my PC hang Pin
Anand Desai7-Aug-08 2:21
Anand Desai7-Aug-08 2:21 
GeneralRe: Code which caused my PC hang Pin
Dan Neely7-Aug-08 2:16
Dan Neely7-Aug-08 2:16 
GeneralRe: Code which caused my PC hang Pin
Yusuf8-Aug-08 11:04
Yusuf8-Aug-08 11:04 
GeneralRe: Code which caused my PC hang Pin
AeonBlue7-Aug-08 4:42
AeonBlue7-Aug-08 4:42 
GeneralRe: Code which caused my PC hang Pin
Paul Conrad7-Aug-08 10:50
professionalPaul Conrad7-Aug-08 10:50 

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.