Click here to Skip to main content
15,886,067 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: What this 'null' check doing here... Pin
GrumpyPants10-Jul-13 5:33
GrumpyPants10-Jul-13 5:33 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed10-Jul-13 19:35
professionalMohammed Hameed10-Jul-13 19:35 
GeneralRe: What this 'null' check doing here... Pin
RafagaX10-Jul-13 5:43
professionalRafagaX10-Jul-13 5:43 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed10-Jul-13 19:43
professionalMohammed Hameed10-Jul-13 19:43 
GeneralRe: What this 'null' check doing here... Pin
Michael Losinski10-Jul-13 5:59
Michael Losinski10-Jul-13 5:59 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed10-Jul-13 19:45
professionalMohammed Hameed10-Jul-13 19:45 
GeneralRe: What this 'null' check doing here... Pin
KP Lee10-Jul-13 21:01
KP Lee10-Jul-13 21:01 
GeneralRe: What this 'null' check doing here... Pin
Michael Losinski11-Jul-13 3:40
Michael Losinski11-Jul-13 3:40 
Yes you could the code down to one line of code. You could catch the exception somewhere else, so I suppose the question could then become what do you do in a mission critical system when outofmemory exception or an allocation fails, therefore allowing you to gracefully shutdown. First thing that comes to mind is if the current thread is not mission critical you can kill that can free up some memory. Second, you could have a fail-safe that would allow you to kill all non-mission critical threads thus freeing memory. With the right permissions you could also kill the other applications. I've never implemented one but you could also have a "memory para-shoot" that at the start of the program allocates a chunk of memory and frees it when needed. I suppose allot of it depend on the system and requirements.
GeneralRe: What this 'null' check doing here... Pin
Nilesh Shahane10-Jul-13 8:07
Nilesh Shahane10-Jul-13 8:07 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed10-Jul-13 19:47
professionalMohammed Hameed10-Jul-13 19:47 
GeneralRe: What this 'null' check doing here... Pin
MainFrameMan_ALIVE_AND_WELL$$10-Jul-13 10:03
MainFrameMan_ALIVE_AND_WELL$$10-Jul-13 10:03 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed10-Jul-13 19:48
professionalMohammed Hameed10-Jul-13 19:48 
GeneralRe: What this 'null' check doing here... Pin
KP Lee10-Jul-13 21:13
KP Lee10-Jul-13 21:13 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed10-Jul-13 21:15
professionalMohammed Hameed10-Jul-13 21:15 
GeneralRe: What this 'null' check doing here... Pin
DarkChuky CR12-Jul-13 12:56
DarkChuky CR12-Jul-13 12:56 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed14-Jul-13 19:46
professionalMohammed Hameed14-Jul-13 19:46 
GeneralRe: What this 'null' check doing here... Pin
Chad3F13-Jul-13 19:17
Chad3F13-Jul-13 19:17 
GeneralRe: What this 'null' check doing here... Pin
Mohammed Hameed14-Jul-13 19:45
professionalMohammed Hameed14-Jul-13 19:45 
GeneralRe: What this 'null' check doing here... Pin
Chad3F14-Jul-13 19:55
Chad3F14-Jul-13 19:55 
GeneralMore mining from our deep seam of WTF's Pin
Rob Grainger1-Jul-13 3:17
Rob Grainger1-Jul-13 3:17 
GeneralRe: More mining from our deep seam of WTF's PinPopular
jim lahey1-Jul-13 4:13
jim lahey1-Jul-13 4:13 
GeneralRe: More mining from our deep seam of WTF's Pin
Rob Grainger1-Jul-13 4:54
Rob Grainger1-Jul-13 4:54 
GeneralRe: More mining from our deep seam of WTF's Pin
charlieg1-Jul-13 5:10
charlieg1-Jul-13 5:10 
JokeRe: More mining from our deep seam of WTF's Pin
jim lahey2-Jul-13 22:58
jim lahey2-Jul-13 22:58 
GeneralRe: More mining from our deep seam of WTF's Pin
Nagy Vilmos3-Jul-13 2:58
professionalNagy Vilmos3-Jul-13 2:58 

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.