<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi James,</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Le 09/08/2019 à 02:19, James Richters a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:01bf01d54e48$20d68840$628398c0$@productionautomation.net">
<pre class="moz-quote-pre" wrap="">so this was strange... it was working before
line 81 For J := 1 to Length(PortPath)-1 do
line 82 Write('->',PortPath[I]);
Line 82 is using variable I but it's in a loop that uses J, I didn't think that made a lot of sense.. so without really analyzing how any of this was supposed to work.. I just changed the I to a J and then I got this:
</pre>
</blockquote>
<p>I think it's a typo. <br>
</p>
<p>I think we didn't saw it before because Range type checking was
disabled ( <span class="cmsy-10">{</span><span class="cmtt-10">$RANGECHECKS
OFF</span><span class="cmsy-10">} </span>or {$R-} ). <br>
</p>
<p>It seems it's the default value for the compiler:
<a class="moz-txt-link-freetext" href="https://www.freepascal.org/docs-html/prog/progsu65.html">https://www.freepascal.org/docs-html/prog/progsu65.html</a> . Very
often in Windows system functions you have to deal with records
with declared with a length of 1 and the real length stored a few
bytes before in the record. This could not work with {$R+} </p>
<p>But it's seems that for some reason it's enabled for your
compiler (may be a different default value when your recompiled
with fpcupdeluxe, or more likely a different default value in your
settings for fp.exe ?).</p>
<p>I'm not an expert in memory allocation, but I think that while a
certain amount of memory is allocated after the memory pointed to
by PortPath and you're in {$R-} mode, you can happily read several
bytes after the actual end of PortPath without any segmentation
fault or memory access exception.<br>
</p>
<p><span class="cmsy-10"></span></p>
<p><br>
</p>
<pre class="moz-signature" cols="72">
</pre>
</body>
</html>