<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 02 Jul 2014, at 12:26, Virgo Pärna wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; 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; "><span class="Apple-style-span" style="font-family: monospace; ">On Wed, 2 Jul 2014 11:23:33 +0200, Jonas Maebe <<a href="mailto:jonas.maebe@elis.ugent.be">jonas.maebe@elis.ugent.be</a>> wrote:<br><blockquote type="cite"><br></blockquote><blockquote type="cite">As has been mentioned earler in the thread, MyReturnStr itself is a  <br></blockquote><blockquote type="cite">pchar.</blockquote><br>   Sorry, I had to recheck thred multiple times before I found it. Initially<br>he did not mention the type at all.<br></span></span></blockquote><div><br></div><div>I know, that's why I initially also wrongly assumed that it was an ansistring and hence also proposed @<span class="Apple-style-span" style="font-family: monospace; ">MyReturnStr[1] in my first reply</span>.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; 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; "><span class="Apple-style-span" style="font-family: monospace; ">   Anyway, if variable is of type PChar, then there is not reason to take<span class="Apple-converted-space"> </span><br>an address of first element to pass it to PChar. Passing wariable itselt is<span class="Apple-converted-space"> </span><br>much clearer.<br></span></span></blockquote><div><br></div><div>I disagree. People make mistakes all the time with dynamic data structures, forgetting that they are implicit pointers (or getting run time errors when they change the type of a variable from a static into a dynamic one). Passing the address of the first element is however always correct. The only downside is that the index of the first element may change, although for strings it won't (unless you switch to {$zerobasedstrings}) and for arrays you could solve that with @MyReturnStr[low(MyReturnStr)] (in case you often replace arrays with one using a different lower bound -- but in that case, other code may break too).</div><div><br></div><div><br></div><div>Jonas</div></div></body></html>