<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Howard are you saying FPC has dynamic arrays? Is it documented? I've been reading the documentation page by page and I've not seen any mention of it. I'm far from completing the reading by the way.<div><br></div><div>If dynamic arrays are part of FPC I couldn't be more delighted. I don't completely understand what they are exactly. Would I be right in saying they have the advantages of a linked list without the loss of speed that I so enjoy with arrays? Maybe linked lists are slow for me because of the way I wrote the code. The problem I have with arrays is that I often parse postscript vector art files. These files have to be read in a discovery mode approach because I don't know how many paths I will encounter nor know how many vertices will be in a path. As a result arrays are large enough to accommodate the largest path but are way overkill for a simple path.</div><div><br></div><div>My hope would be that I could use a dynamic array to hold just the number of vertices I discover in a path.</div><div><br></div><div>Thanks for sharing the code in your post. It fascinates me.</div><div><br></div><div>I'm eager to learn all I can about about the amazing things that can be done with FPC. To all those who have been building FPC, thank you. While I have been programming in pascal since 1986 almost daily I've relied on the basic features of the language. Time to stretch my mind.</div><div><br></div><div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>Thomas Young</div><div>cell: 330-256-7064</div><div>mobile email: <a href="mailto:tygraphics@me.com">tygraphics@me.com</a></div><div><br></div></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Feb 9, 2012, at 1:08 PM, Howard Page-Clark wrote:</div><blockquote type="cite"><div><br>You have to declare the parameter type independently of the function declaration. You can also do it without declaring an additional pointer type (which is also one way to do it), since dynamic arrays already have an implicit pointer. Something like this:<br><br>type<br> TInfo=record<br> s: string;<br> i: integer;<br> end;<br><br> TInfoArr = array of tInfo;<br><br>procedure proc1(a: TInfoArr);<br><br>implementation<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var rec: TInfo;<br> infoArr: TInfoArr = nil;<br>begin<br> SetLength(infoArr, 2);<br> rec.i := 1; rec.s := 'test1';<br> infoArr[0] := rec;<br> rec.i := 2; rec.s := 'test2';<br> infoArr[1] := rec;<br> proc1(infoArr);<br>end;<br><br>procedure proc1(a: TInfoArr);<br>var s: string = '';<br> i: integer;<br>begin<br> for i := Low(a) to High(a) do<br> s := s + Format('TInfo%d: s=%s, i=%d ',[i, a[i].s, a[i].i]);<br> Showmessage(s);<br>end;<br>_______________________________________________<br>fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br><a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br></div></blockquote></div><br></div></body></html>