A couple of thoughts/queries.
Bill Baxter
dnewsgroup at billbaxter.com
Tue Dec 25 17:27:09 PST 2007
Christopher Wright wrote:
> 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.
ddbg does a pretty decent job on Windows. Still, it gives me no stack
trace upon "access violation" a significant fraction of the time. When
it works it's great, though. You should definitely be using it if
you're on Windows. I have also found that Windbg can sometimes get a
stack trace when ddbg can't.
If you're not on Windows then I presume gdb works? I guess that doesn't
have any D-specific knowledge. Support for D in zerobugs is still
vaporware?
Still, I'm with you. Getting a stack trace should be easier.
Especially considering there have been patches to phobos floating around
for a year at least that already implement it.
--bb
More information about the Digitalmars-d
mailing list