View mode: basic / threaded / horizontal-split · Log in · Help
May 30, 2005
Access Violations
In D, I seem to come accross Access Violations, ALL THE TIME...

I never got these so much in C and C++.. I wish I knew what i was always doing
wrong, and I try to learn from my mistakes, but it still seems odd to me.

are there some common pitfals many of you fall into in developing in D that
cause these nasty little errors? Are there more advanced ways to detect the
source and more creative ways to avoid them than process of elimination on the
back end?

I am writing this windows GUI wrapper of sorts, Terra, and it's giving me allot
of issues. Are there things I should know about extern(Windows) that I might not
be taking into account..?

The source will be up on http://svn.dsource.org/projects/terra/downloads/

I appaicate all help, and if you are interested, send me a patch to
trevorparscal@hotmail.com

Thanks in advance.

Thanks,
Trevor Parscal
www.trevorparscal.com
trevorparscal@hotmail.com
May 30, 2005
Re: Access Violations
Is an access violation the same thing as a segmentation fault?

Anyway, I used to get a lot of seg faults from forgetting to 'new' a 
class. To stop this from happening, I use asserts and contracts as 
follows...

void function(MyClass s)
in
{
  assert(s !== null);
}
body
{
   // ... etc
}

Also, I use the debuggers backtrace to tell me around the place where my 
program crashes, and I also use a dose of writef's in debug mode that 
give me an idea where/what the program is doing. If you are using build, 
maybe try adding the -full option.

Trevor Parscal wrote:
> In D, I seem to come accross Access Violations, ALL THE TIME...
> 
> I never got these so much in C and C++.. I wish I knew what i was always doing
> wrong, and I try to learn from my mistakes, but it still seems odd to me.
> 
> are there some common pitfals many of you fall into in developing in D that
> cause these nasty little errors? Are there more advanced ways to detect the
> source and more creative ways to avoid them than process of elimination on the
> back end?
> 
> I am writing this windows GUI wrapper of sorts, Terra, and it's giving me allot
> of issues. Are there things I should know about extern(Windows) that I might not
> be taking into account..?
> 
> The source will be up on http://svn.dsource.org/projects/terra/downloads/
> 
> I appaicate all help, and if you are interested, send me a patch to
> trevorparscal@hotmail.com
> 
> Thanks in advance.
> 
> Thanks,
> Trevor Parscal
> www.trevorparscal.com
> trevorparscal@hotmail.com
Top | Discussion index | About this forum | D home