Null references redux

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Sep 26 20:03:01 PDT 2009


On Sat, Sep 26, 2009 at 10:59 PM, Jeremie Pelletier <jeremiep at gmail.com> wrote:

> The compiler won't be able to enforce *every* nonnull reference and
> segfaults are bound to happen, especially with casting. While it may prevent
> most of them, any good programmer would too, I don't remember the last time
> I had a segfault on a null reference actually.
>
> I can see what the point is with nonnull references, but I can also see its
> not a bulletproof solution. ie "Object foo = cast(Object)null;" would easily
> bypass the nonnull enforcement, resulting in a segfault the system is trying
> to avoid.
>
> What about function parameters, a lot of parameters are optional references,
> which are tested and then used into functions whose parameters aren't
> optional. It would result in a lot of casts, something that could easily
> confuse people and easily generate segfaults.

You haven't read my reply to your post yet, have you.

Nullable.



References.



Exist.



Too.



More information about the Digitalmars-d mailing list