A couple of thoughts/queries.
Christopher Wright
dhasenan at gmail.com
Tue Dec 25 17:21:19 PST 2007
Walter Bright wrote:
> Robby wrote:
>> Anyways, what I'm in hopes of finding is a way to tell the compiler
>> that I never want null, ever. I want an instance of the class and
>> that's that. The whole idea of taking every lil runtime hit for
>> checking and the code cruft for writing it when in fact it's
>> something that seems to be easy for a compiler to do the work for me.
>
> The hardware will do the check for null pointer for you every time you
> do a dereference.
I wouldn't mind this. Only problem is, you don't get a file or line
number. You don't get any clue where the problem is. You're left with
debugging by printfs or attaching a debugger, and D doesn't have great
debugger support at the moment. Either way takes much more time than
simply reading an exception.
You might be able to trap SIGSEGV and output the last file and line
number executed. The former's easy; the latter might require more upkeep
than watching pointer dereferences.
More information about the Digitalmars-d
mailing list