[fpc-pascal] access violation?

Sven Barth pascaldragon at googlemail.com
Tue Jul 31 07:08:08 CEST 2018


Ryan Joseph <ryan at thealchemistguild.com> schrieb am Mo., 30. Juli 2018,
18:05:

>
>
> > On Jul 28, 2018, at 2:03 AM, Sven Barth via fpc-pascal <
> fpc-pascal at lists.freepascal.org> wrote:
> >
> > The method you provided below would not fail anyway, because it doesn't
> dereference Self. If you'd however access for example a field of your class
> then a check should be inserted inside the method. For some reason it isn't
> however and *that* is the bug.
>
> Just getting back to this now.
>
> Thanks for the description, I didn’t know FPC behaved that way but it’s
> good to know.
>
> However, I’ve never had a use for this (outside of calling Free as I
> learned and the way I’ve always programmed Pascal, accessing nil is an
> error or undefined behavior so I avoid it meticulously.
>
> How can I disable this so calling a method on nil gives an error?
>

If the method doesn't access Self then there is nothing you can do.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180731/9c5f328f/attachment.html>


More information about the fpc-pascal mailing list