Why does this simple program segfault?
Jarrett Billingsley
kb3ctd2 at yahoo.com
Wed Aug 15 14:41:31 PDT 2007
"Chad J" <gamerChad at _spamIsBad_gmail.com> wrote in message
news:f9tu35$1d7q$1 at digitalmars.com...
>
> I think a worse problem though is how D errors on null dereferencing. On
> windows I get Access Violations, and I think the segv is a linux thing if
> I remember correctly. Such error messages are completely unhelpful while
> debugging. The following should probably be done:
>
> instance.member = something;
>
> becomes
>
> assert(instance !is null,
> format("%s,%d: %s is null!",
> __FILE__,__LINE__,instance.stringof)
> );
> instance.member = something;
>
> It would be sort of like how arrays are bounds checked at runtime unless
> in release mode.
Was suggested, shot down, forgotten. :\
More information about the Digitalmars-d-learn
mailing list