Segmentation fault hell in D

Justin Whear justin at economicmodeling.com
Fri Jun 8 11:00:46 PDT 2012


On Fri, 08 Jun 2012 19:30:57 +0200, Jarl André wrote:

> Evry single time I encounter them I yawn. It means using the next
> frickin hour to comment away code, add more log statements and try to
> eleminate whats creating the hell of bugz, segmantation fault. Why can't
> the compiler tell me anything else than the fact that i have referenced
> data that does not exist? Thanks I knew that. Now, please tell me where
> the error occured.... Jeezes.

The compiler can't really help you (aside from maybe adding dereference 
checks everywhere) because you have a logic error, not something that can 
be statically determined. This is why debuggers exist. Whenever I get a 
segfault, I fire up GDB and recreate it. If you've compiled with -g, GDB 
can usually tell you the exact line the problem occurred on and a full 
backtrace to help you figure out how you got there.


More information about the Digitalmars-d-learn mailing list