ISO Pascal reference manual
ISO Pascal reference manual
ISO Pascal reference manual
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
*Execution error -- NIL pointer used<br />
Appendix C<br />
This message indicates that an attempt has been made to follow a pointer<br />
which is currently NIL. As this means that the pointer is not pointing at<br />
anything the operation would be meaningless.<br />
PROGRAM error(output);<br />
TYPE pi = !integer;<br />
VAR a : pi;<br />
BEGIN<br />
END.<br />
a := NIL;<br />
a! := 123; (wrong}<br />
writeln('Error not detected');<br />
*Execution error -- disposing NIL pointer<br />
This error is the result of calling DISPOSE on a pointer which has the value<br />
NIL.<br />
PROGRAM error(output);<br />
VAR pi : !real;<br />
BEGIN<br />
END.<br />
pi := NIL;<br />
Dispose(pi);<br />
writeln('Error not detected');<br />
*Execution error -- <strong>reference</strong> to DISPOSED object<br />
This message indicates that a pointer has been left pointing to the remains<br />
of an object that has been disposed. This is usually the result of copying a<br />
pointer variable and using the copy after DISPOSE has been applied to the<br />
original.<br />
PROGRAM error(output);<br />
TYPE pi =Tinteger;<br />
VAR original, copy : pi;<br />
BEGIN<br />
NEW(original);<br />
original! := 123; (valid}<br />
<strong>Pascal</strong> Issue 1 107