Jonas<br><br>Thank you Jonas, for clearing that up. I agree.<br><br>You have more courage than I my friend to say that, for down that path lies monsters. For while I must agree with your point, in theory it raises a bigger concern. <br>
<br>The 'nil' for a pointer constant is problematic in two ways. Fixing this 'bug' could mean addressing two language issues. Type checking for valid pointer arithmetic and the difference between a 'null' or empty pointer and one that has the lowest value of it's type. <br>
<br>Both those points may sound abstract and esoteric, but they lie at the heart of the 'fix' for this bug. As you can surmise, for a strongly typed language like Object Pascal, pointer operations should be 'type safe' at best and 'type neutral' for flexibility and utility. <br>
<br>Even the apparently simple addition of numeric literal and a pointer requires considerable thought for reasons of portability and ensuring that pointer arithmetic doesn't become a source of opaque bugs. <br><br>
Prince <br>
<br><br><br><div class="gmail_quote">On Mon, May 25, 2009 at 8:43 PM, Jonas Maebe <span dir="ltr"><<a href="mailto:jonas.maebe@elis.ugent.be">jonas.maebe@elis.ugent.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
On 25 May 2009, at 22:39, Prince Riley wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
That's a very interesting answer. So am I understanding you to say that the<br>
expression of the form<br>
<br>
var := constant + numeric literal ;<br>
<br>
is an invalid expression (syntax) in Object Pascal?<br>
</blockquote>
<br></div>
No, I meant that there was a bug (error) in the compiler regarding handling expressions of the form "nil + <integer constant>". It's a valid expression. nil has as type "pointer", and you can add integers to untyped pointers (constant or not). The result is again an untyped pointer.<div>
<div></div><div class="h5"><br>
<br>
<br>
Jonas<br>
_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</div></div></blockquote></div><br>