Hello,<br><br>I had a chance to go to a reference and check on what the reserved word 'nil' , a special constant, seems to mean. According to the Object Pascal manual (Borland) ... <br><br><div style="margin-left: 40px;">

"The reserved word nil is a special constant that can be assigned to any pointer. When nil is assigned to a pointer, the pointer doesn't reference anything."<br></div><br>Since a pointer is a memory address  value, then the interpretation of the statement "nil +1" would mean for p to point at the very next valid address above the lowest memory address 'p' can hold.  So it would appear that 'p := nil + 1' should not compile or work. <br>

<br>My guess, and its just a guess, is that for 'nil + 1' to work then it would have to be done in two steps and not one, e.g. 'p := nil; p := p +1; ' .. both of which are valid statements. Now I have no idea what size address increment the compiler would choose (byte, word, float, etc.) to add to p. Perhaps it assumes PChar ..  <br>

<br>But if that's  not how it works, then my next question about the interpretation of 'p := nil + 1; ' is what is the 'size' of the 'p + 1' increment? How can that increment be set to without casting 'p' to a specific Pascal type (Integer, Char, Byte, Word, etc.). <br>

<br>So for Object Pascal the side effect of the statement 'p := nil +1' has to be valid address. As such the compiler does not know the type of object 'p' points at, it can't create a valid address.  <br>

<br>On the other hand, untyped Pointers are a compromise in Object Pascal , a strongly typed language, to be similar to untyped pointer expressions  like void * pointers in "C". Untyped C language pointers, according to K&R, represent the smallest unit of addressable memory for the CPU architecture (bytes on Intel). <br>

<br>However, even in C, the closest equivalent expression to 'p := nil + 1', void *p, is 'p = NULL, p = p + 1' works (compiles) but issues a warning about the  'p = p + 1' expression (GCC v4).<br>
<br>
<br><br> <br><br><div class="gmail_quote">On Mon, May 25, 2009 at 12:48 PM, Prince Riley <span dir="ltr"><<a href="mailto:wmarketing3@gmail.com">wmarketing3@gmail.com</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;">

Hello,<br><br>There seems to be a bigger issue on this... but perhaps someone else confirm that the following programs, similar to the failing one, work. <br><br>program test1;<br>  var <br>     p: Pointer;<br>  begin<br>

    p := nil;<br>
    p := p + 1;<br>end.<br><br>Does work .... and the following program<br><br>program test2;<br>   var <br>        p: Pointer;<br>   begin<br>        p := nil;<br>        Inc(p);<br>  end. <br><br>works also ....    am I the only one getting this result?<br>

<font color="#888888">
<br>Prince</font><div><div></div><div class="h5"><br><br><br><div class="gmail_quote">On Sun, May 24, 2009 at 4:30 PM, Joost van der Sluis <span dir="ltr"><<a href="mailto:joost@cnoc.nl" target="_blank">joost@cnoc.nl</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;">
Op zondag 24-05-2009 om 23:14 uur [tijdzone +0200], schreef Aleksa<br>
Todorovic:<br>
<div>> Hi, all!<br>
><br>
> I've just tried to compile some of my old Pascal code, and got IE<br>
> 200307043. I've tried both 2.2.4 and svn trunk versions. Simple<br>
> program to generate it:<br>
><br>
> program test;<br>
> var<br>
>   p: Pointer;<br>
> begin<br>
>   p := nil + 1;<br>
> end.<br>
><br>
> I couldn't find issue about this in bug tracker, should I report it?<br>
<br>
</div>Yes, an IE is always a bug an should be reported. If you can not a<br>
report with '200307043' in it, it's not reported yet.<br>
<font color="#888888"><br>
Joost.<br>
</font><div><div></div><div><br>
<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>
</div></div></blockquote></div><br>