Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-09 Thread Bart via fpc-devel
On Mon, Apr 7, 2025 at 1:12 PM Marco van de Voort via fpc-devel wrote: > IMHO it is a feature better forgotten. +1, it's an abomination IMHO ;-) Out of curiosity: could the zerobased-ness of the string be stored in the string's "header"? -- Bart ___

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-08 Thread Sven Barth via fpc-devel
Bart via fpc-devel schrieb am Di., 8. Apr. 2025, 22:20: > On Tue, Apr 8, 2025 at 12:09 AM Sven Barth via fpc-devel > wrote: > > > >> > Please report a bug. > >> Done: https://gitlab.com/freepascal.org/fpc/source/-/issues/41228 > > > > > > Turns out I had been too eager to request a bug report. B

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-08 Thread Bart via fpc-devel
On Tue, Apr 8, 2025 at 12:09 AM Sven Barth via fpc-devel wrote: >> > Please report a bug. >> Done: https://gitlab.com/freepascal.org/fpc/source/-/issues/41228 > > > Turns out I had been too eager to request a bug report. But thank you > nevertheless. 😅 Well, similar off-by-one inconsistencies

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-08 Thread Kazantsev Alexey via fpc-devel
On Sun, 6 Apr 2025 23:18:47 +0200 Bart via fpc-devel wrote: > Hi, > > Is this a known issue? > Outputs: > S[0]= "A" [Ok] > S[1]= "B" [Ok] > S[2]= "C" [Ok] > Copy(S,0,1) = "A" [Ok] > Copy(S,1,1) = "A", FAIL: expected: B In the Delphi {$zerobasedstrings on/off} : 1. Strin

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-07 Thread Sven Barth via fpc-devel
Bart via fpc-devel schrieb am Mo., 7. Apr. 2025, 19:40: > On Mon, Apr 7, 2025 at 8:17 AM Sven Barth via fpc-devel > wrote: > > > > Please report a bug. > Done: https://gitlab.com/freepascal.org/fpc/source/-/issues/41228 Turns out I had been too eager to request a bug report. But thank you neve

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-07 Thread Stefan Glienke via fpc-devel
No because the feature is related to the state of the ZBS switch at the source code location, not to the string instance. > On 07/04/2025 19:40 CEST Bart via fpc-devel > wrote: > > > On Mon, Apr 7, 2025 at 1:12 PM Marco van de Voort via fpc-devel > wrote: > > > IMHO it is a feature better

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-07 Thread Bart via fpc-devel
On Mon, Apr 7, 2025 at 8:17 AM Sven Barth via fpc-devel wrote: > Please report a bug. Done: https://gitlab.com/freepascal.org/fpc/source/-/issues/41228 -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-07 Thread Sven Barth via fpc-devel
Martin Frb via fpc-devel schrieb am Mo., 7. Apr. 2025, 08:13: > On 07/04/2025 08:01, Sven Barth via fpc-devel wrote: > > > > Also it would be best to simply document as UTF8Copy working 1-based > > because you can't detect from the callee-side whether it had been > > enabled on the caller-side (e

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-07 Thread Marco van de Voort via fpc-devel
Op 7-4-2025 om 08:13 schreef Martin Frb via fpc-devel: On 07/04/2025 08:01, Sven Barth via fpc-devel wrote: Also it would be best to simply document as UTF8Copy working 1-based because you can't detect from the callee-side whether it had been enabled on the caller-side (especially if they'r

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-06 Thread Martin Frb via fpc-devel
On 07/04/2025 08:01, Sven Barth via fpc-devel wrote: Also it would be best to simply document as UTF8Copy working 1-based because you can't detect from the callee-side whether it had been enabled on the caller-side (especially if they're from different units). Just an idea. Maybe having 2

Re: [fpc-devel] Copy() and ZeroBaseStrings

2025-04-06 Thread Sven Barth via fpc-devel
Bart via fpc-devel schrieb am So., 6. Apr. 2025, 23:19: > Hi, > > Is this a known issue? > === > program z; > > {$longstrings on} > {$zerobasedstrings on} > > var > S, T: string; > begin > S := 'ABC'; > write('S[0]= "',S[0],'"'); > if (S[0] <> 'A') then writeln(', FAIL: expected:

[fpc-devel] Copy() and ZeroBaseStrings

2025-04-06 Thread Bart via fpc-devel
Hi, Is this a known issue? === program z; {$longstrings on} {$zerobasedstrings on} var S, T: string; begin S := 'ABC'; write('S[0]= "',S[0],'"'); if (S[0] <> 'A') then writeln(', FAIL: expected: A') else writeln(' [Ok]'); write('S[1]= "',S[1],'"'); if (S[1] <> 'B') th