<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Martin Frb via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Mo., 7. Apr. 2025, 08:13:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 07/04/2025 08:01, Sven Barth via fpc-devel wrote:<br>
><br>
> Also it would be best to simply document as UTF8Copy working 1-based <br>
> because you can't detect from the callee-side whether it had been <br>
> enabled on the caller-side (especially if they're from different units).<br>
><br>
<br>
Just an idea.<br>
<br>
Maybe having 2 underlying string types for 0 and 1 based. Then it would <br>
be possible to use overload.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">No. This would not be compatible with Delphi from which this feature stems. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Btw, "from the calling side", before I search the doc, what happens if<br>
<br>
Unit1 // has 0 base strings<br>
var foo: ansistring; //global<br>
foo := 'abc';<br>
<br>
unit2 // has 1 based strings<br>
writeln(foo[1]); // follows 1 based or follows declaration 0 based?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">It has nothing to do with the declaration. It's a local switch that controls whether a 1 is implicitly added by the compiler when accessing a string using [] accesses or intrinsics.</div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>