Click here to Skip to main content
15,884,176 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
Mark Starr16-Jul-13 5:20
professionalMark Starr16-Jul-13 5:20 
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 
Michael Losinski wrote:
The only thing that I can think of is technically new doesn't guarantee that the variable initialization will take place.
Who cares? If the "if" check returns true, the result of calling the routine could make it null. If it's mission critical, initialize it by calling the function and then throw it when the function sets it to null. (Which it doesn't seem to check for, when that is a very possible result of calling the function.) If you are so constrained by memory the new would fail, it'd fail in the function too, thereby throwing an error the code doesn't check for(catch).
GeneralRe: What this 'null' check doing here... Pin
Michael Losinski11-Jul-13 3:40
Michael Losinski11-Jul-13 3:40 
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 

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.