Click here to Skip to main content
15,902,492 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: Percent-decoding a URL Pin
Luc Pattyn23-Dec-08 16:17
sitebuilderLuc Pattyn23-Dec-08 16:17 
GeneralRe: Percent-decoding a URL Pin
Chris Meech24-Dec-08 2:24
Chris Meech24-Dec-08 2:24 
GeneralNULL Checking and Defensive Programming Pin
Swinefeaster18-Dec-08 19:11
Swinefeaster18-Dec-08 19:11 
GeneralRe: NULL Checking and Defensive Programming PinPopular
Deflinek18-Dec-08 23:07
Deflinek18-Dec-08 23:07 
GeneralRe: NULL Checking and Defensive Programming Pin
AshokParikh18-Dec-08 23:38
AshokParikh18-Dec-08 23:38 
GeneralRe: NULL Checking and Defensive Programming Pin
Robert Surtees19-Dec-08 2:56
Robert Surtees19-Dec-08 2:56 
GeneralRe: NULL Checking and Defensive Programming Pin
PIEBALDconsult19-Dec-08 2:58
mvePIEBALDconsult19-Dec-08 2:58 
GeneralRe: NULL Checking and Defensive Programming Pin
bmcleod19-Dec-08 3:28
bmcleod19-Dec-08 3:28 
I think most agree that once you declare a pointer than the next logical step should be to point it to something. Preferably that something is a value other than null. However, there are perfectly legitimate cases for assigning a null value to a pointer , for example the implementation of a linked list where the last element points to nothing (null). These situations should be by design.
If you follow the practice of assigning values to pointers as soon as you declare them than you should minimize the risk of dereferencing a null pointer. However, like anything else there is no guarantee. Thus I recommend some type of centralized error handling scheme that would gracefully handle this exception as opposed to Null pointer checks prior to using the pointer.
GeneralRe: NULL Checking and Defensive Programming Pin
notmasteryet19-Dec-08 3:37
notmasteryet19-Dec-08 3:37 
GeneralRe: NULL Checking and Defensive Programming Pin
Le centriste19-Dec-08 4:58
Le centriste19-Dec-08 4:58 
GeneralRe: NULL Checking and Defensive Programming Pin
Randor 19-Dec-08 5:54
professional Randor 19-Dec-08 5:54 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic20-Dec-08 15:21
Nemanja Trifunovic20-Dec-08 15:21 
GeneralRe: NULL Checking and Defensive Programming Pin
Randor 20-Dec-08 18:30
professional Randor 20-Dec-08 18:30 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic21-Dec-08 4:16
Nemanja Trifunovic21-Dec-08 4:16 
GeneralRe: NULL Checking and Defensive Programming [modified] Pin
Nemanja Trifunovic19-Dec-08 12:07
Nemanja Trifunovic19-Dec-08 12:07 
GeneralRe: NULL Checking and Defensive Programming Pin
PIEBALDconsult19-Dec-08 17:10
mvePIEBALDconsult19-Dec-08 17:10 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic20-Dec-08 12:55
Nemanja Trifunovic20-Dec-08 12:55 
GeneralRe: NULL Checking and Defensive Programming Pin
PIEBALDconsult20-Dec-08 13:44
mvePIEBALDconsult20-Dec-08 13:44 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic20-Dec-08 14:46
Nemanja Trifunovic20-Dec-08 14:46 
GeneralRe: NULL Checking and Defensive Programming Pin
PIEBALDconsult20-Dec-08 17:00
mvePIEBALDconsult20-Dec-08 17:00 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic20-Dec-08 17:08
Nemanja Trifunovic20-Dec-08 17:08 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic21-Dec-08 4:19
Nemanja Trifunovic21-Dec-08 4:19 
GeneralRe: NULL Checking and Defensive Programming Pin
Dave Kreskowiak20-Dec-08 20:28
mveDave Kreskowiak20-Dec-08 20:28 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic21-Dec-08 4:00
Nemanja Trifunovic21-Dec-08 4:00 
GeneralRe: NULL Checking and Defensive Programming Pin
PIEBALDconsult21-Dec-08 4:02
mvePIEBALDconsult21-Dec-08 4:02 

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.