Why does this simple program segfault?

Lars Noschinski lars-2006-1 at usenet.noschinski.de
Fri Aug 17 10:36:59 PDT 2007


* Anders F Björklund <afb at algonet.se> [07-08-15 08:38]:
>Bill Baxter wrote:
>
>>I guess the best we can hope for is some kind of better error message than 
>>just a generic segfault, or perhaps a compiler warning if you forget to 
>>initialize a class instance.
>
>Aren't those segfaults the famous "hardware exceptions", that you get
>"for free" instead of the compiler having to throw real exceptions ?

On Unix systems, a segmentation fault triggers a SIGSEGV signal, which -
by default - results in program termination. It can be catched, but IIRC
the state of the program is undefined afterwards.


More information about the Digitalmars-d-learn mailing list