Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# versus C++, null references and protecting against them Pin
bob1697215-Jan-11 5:00
bob1697215-Jan-11 5:00 
AnswerRe: C# versus C++, null references and protecting against them Pin
Chuck O'Toole15-Jan-11 17:14
Chuck O'Toole15-Jan-11 17:14 
GeneralRe: C# versus C++, null references and protecting against them Pin
bob1697215-Jan-11 19:23
bob1697215-Jan-11 19:23 
GeneralRe: C# versus C++, null references and protecting against them Pin
Chuck O'Toole15-Jan-11 20:56
Chuck O'Toole15-Jan-11 20:56 
GeneralRe: C# versus C++, null references and protecting against them Pin
bob1697216-Jan-11 5:24
bob1697216-Jan-11 5:24 
GeneralRe: C# versus C++, null references and protecting against them Pin
Chuck O'Toole16-Jan-11 6:00
Chuck O'Toole16-Jan-11 6:00 
GeneralRe: C# versus C++, null references and protecting against them Pin
Paul Michalik16-Jan-11 7:39
Paul Michalik16-Jan-11 7:39 
GeneralRe: C# versus C++, null references and protecting against them Pin
Chuck O'Toole16-Jan-11 7:57
Chuck O'Toole16-Jan-11 7:57 
Well, that is true to some extent (the undefined behavior part, not the malformed part Smile | :) )

Unfortunately, I don't live in the happy world where I can rely on everybody following the rules or where I can hold up a standard and claim it's not my fault that my code blew up.

I live in a world, somewhat dominated by Microsoft whose implementation details have real effects, where my libraries, reusable modules, etc are to be used by other programmers and they will often have bugs. I try my best to prevent their bugs from crashing my code but instead give them a reasonable exception or other error indicator so they can find their own bugs without calling me to say "your code crashed".

Perhaps this is ingrained in me from my early years of operating system development where a kernel crash was the worst possible thing regardless of what the "user" did to it via the APIs. Imagine how angry people would get if simple calls to the base Windows APIs would cause blue screens all the time.

paul_71 wrote:
any assumptions about what happens after you took a reference to a "null" pointer are worthless

And this is exactly my point to the OP, his assumption that one cannot get into his code with a null object reference by using "&" is also worthless (your words) as I can clearly demonstrate that you can.

In any event, I will continue to challenge the assertion that one can remove defensive code because "by definition it cannot happen".
GeneralRe: C# versus C++, null references and protecting against them Pin
Chuck O'Toole16-Jan-11 8:30
Chuck O'Toole16-Jan-11 8:30 
GeneralRe: C# versus C++, null references and protecting against them Pin
bob1697216-Jan-11 12:29
bob1697216-Jan-11 12:29 
GeneralRe: C# versus C++, null references and protecting against them Pin
Paul Michalik16-Jan-11 20:35
Paul Michalik16-Jan-11 20:35 
GeneralRe: C# versus C++, null references and protecting against them Pin
Paul Michalik15-Jan-11 23:04
Paul Michalik15-Jan-11 23:04 
GeneralRe: C# versus C++, null references and protecting against them Pin
bob1697216-Jan-11 4:57
bob1697216-Jan-11 4:57 
QuestionCOM error [modified] Pin
polycom12314-Jan-11 8:05
polycom12314-Jan-11 8:05 
QuestionDynamic assembly information Pin
Helfdane14-Jan-11 2:32
Helfdane14-Jan-11 2:32 
AnswerRe: Dynamic assembly information Pin
Ravi Sant14-Jan-11 3:49
Ravi Sant14-Jan-11 3:49 
GeneralRe: Dynamic assembly information Pin
Helfdane16-Jan-11 21:05
Helfdane16-Jan-11 21:05 
AnswerRe: Dynamic assembly information Pin
PIEBALDconsult15-Jan-11 9:08
mvePIEBALDconsult15-Jan-11 9:08 
GeneralRe: Dynamic assembly information Pin
Tony Richards16-Jan-11 8:54
Tony Richards16-Jan-11 8:54 
GeneralRe: Dynamic assembly information Pin
PIEBALDconsult16-Jan-11 14:49
mvePIEBALDconsult16-Jan-11 14:49 
QuestionRunning an exe file ( I mean a program) from inside my own program Pin
Fred 3414-Jan-11 1:41
Fred 3414-Jan-11 1:41 
AnswerRe: Running an exe file ( I mean a program) from inside my own program Pin
PIEBALDconsult14-Jan-11 1:46
mvePIEBALDconsult14-Jan-11 1:46 
AnswerRe: Running an exe file ( I mean a program) from inside my own program PinPopular
Luc Pattyn14-Jan-11 1:48
sitebuilderLuc Pattyn14-Jan-11 1:48 
GeneralRe: Running an exe file ( I mean a program) from inside my own program Pin
Fred 3414-Jan-11 2:00
Fred 3414-Jan-11 2:00 
GeneralRe: Running an exe file ( I mean a program) from inside my own program Pin
Dave Kreskowiak14-Jan-11 4:07
mveDave Kreskowiak14-Jan-11 4:07 

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.