Click here to Skip to main content
15,902,905 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: 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 
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 
Nemanja Trifunovic wrote:
There is no such thing as a "NULL pointer exception" - there is "access violation"


Nemanja,
Come on man I know your not really that pedantic about verbiage. Call it whatever you want, "Access Violation" is simply an error title. Now your just trying to be argumentative. I'll call it segmentation fault[^] from now on just to get under your skin.

Nemanja Trifunovic wrote:
if you follow your rules you may still very easily run into it


First off let me say that I have respect for both you and your philosophy. I can only hope to recieve the same. But unfortunately I have a partially opposing view.

There are many techniques to making software more robust. Assigning pointers to NULL and checking for NULL is only one of them and many companies practice it as can be seen in both Microsoft DDK and Platform SDK samples.

Logically from a mathematical statistics standpoint any technique which reduces the chance of accessing an invalid memory address would be beneficial to the software.

Magic Number[^] assignment/checking is used by all major software vendors.. Apple, Microsoft and IBM etcetera.

Recognize any of these?

0xCDCDCDCD
0xBAADF00D
0xCCCCCCCC

Initializing a pointer to NULL to denote an invalid memory address is the same magic number technique. It assists the programmer with validating pointers and most certainly assists with making software more robust.

I am not interested in arguing the point anymore. I fully expect you to reject my assertions and you are within your rights to do so. Let us agree that we disagree and leave it at that.

Best Wishes,
-David Delaune
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 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic21-Dec-08 4:06
Nemanja Trifunovic21-Dec-08 4:06 
GeneralRe: NULL Checking and Defensive Programming Pin
Randor 20-Dec-08 14:40
professional Randor 20-Dec-08 14:40 
GeneralRe: NULL Checking and Defensive Programming Pin
Nemanja Trifunovic20-Dec-08 15:25
Nemanja Trifunovic20-Dec-08 15:25 
GeneralRe: NULL Checking and Defensive Programming Pin
PIEBALDconsult20-Dec-08 17:05
mvePIEBALDconsult20-Dec-08 17:05 
GeneralRe: NULL Checking and Defensive Programming Pin
PIEBALDconsult20-Dec-08 17:46
mvePIEBALDconsult20-Dec-08 17:46 

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.