[fpc-pascal]Dereferencing Nil Pointers
Jonas Maebe
jonas at zeus.rug.ac.be
Sun Dec 29 15:14:10 CET 2002
On zondag, dec 29, 2002, at 06:03 Europe/Brussels, Mark Emerson wrote:
> I did not find "Attempted to dereference a NIL pointer" as a runtime
> error in FPC (except for error 204 which involves calls to dispose or
> Freemem).
>
> For example:
>
> var
> x : ^char;
> y : char;
> begin
> x := nil;
> y := x^;
> end.
>
> should produce a runtime error at the second statement. This was a
> deficiency in Turbo Pascal.
Actually, it's a deficiency in 16 bit Dos, which can't do zero page
protection. It's still a problem under Windows when running 32 bit Dos
programs, because for some strange reason Windows doesn't allow DPMI
programs to turn on zero page protection (running this program under
Dos/go32v2 does produce a segmentation fault). In all other cases, this
will cause a segmentation fault (run time error 216).
Jonas
More information about the fpc-pascal
mailing list