Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-14 Thread Alexey Tor. via fpc-pascal
That is another reason for PChar based inner func. :) the input might be 00

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-14 Thread Benito van der Zander via fpc-pascal
Hi, I don’t see what the problem with a shortstring buffer is.. strtoint could not make use of an input string longer than 256 characters anyway, because the output integer could not have more than 19 digits anyway.. so an input string longer than this would be useless… just convert to a sho

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-13 Thread Bart via fpc-pascal
On Wed, Jan 12, 2022 at 11:33 PM Sven Barth via fpc-pascal wrote: > You can see it in Florian's commit to the branch about range checking where > he added the DestSize parameter. Yes, I discovered that. Will study a bit how this is done, just for the fun of it. -- Bart __

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Benito van der Zander via fpc-pascal
Hi, If it is correct: Can we skip using ShortString buffer and have e.g. 'common' PChar base function for AnsiString/ShortString? I keep arguing for that as well You can always create such a function yourself,  gain experience using it, and share the source with us. I wrote that for y

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Sven Barth via fpc-pascal
Bart via fpc-pascal schrieb am Mi., 12. Jan. 2022, 22:31: > On Wed, Jan 12, 2022 at 3:13 PM Michael Van Canneyt via fpc-pascal > wrote: > > > From the definition you can see it is a compilerproc function, meaning > that the > > compiler writes direct calls to this. > > To change the signature of

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Bart via fpc-pascal
On Wed, Jan 12, 2022 at 10:28 PM Bart wrote: > Could you naybe point me to where in the compiler this "magic" happens? > (fpc_Val_UInt_Shortstr() signature needs to be changed IMO) Never mind, I just notice a new branch val_range_check was created that just does this. I'll get on trying to fix h

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Bart via fpc-pascal
On Wed, Jan 12, 2022 at 3:13 PM Michael Van Canneyt via fpc-pascal wrote: > From the definition you can see it is a compilerproc function, meaning that > the > compiler writes direct calls to this. > To change the signature of the function means the compiler itself also must > be changed. Coul

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Sven Barth via fpc-pascal
DougC schrieb am Mi., 12. Jan. 2022, 17:57: > So, are you saying the one cannot declare an IntToStr function with the > string represented by a PChar argument? Seems pretty straightforward to me. > > Isn't that what is being requested? > No, it's not. He's requesting to change the functions that

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Michael Van Canneyt via fpc-pascal
On Wed, 12 Jan 2022, James Richters via fpc-pascal wrote: I don’t see what the problem with a shortstring buffer is.. strtoint could not make use of an input string longer than 256 characters anyway, because the output integer could not have more than 19 digits anyway.. so an input string lo

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread James Richters via fpc-pascal
I don’t see what the problem with a shortstring buffer is.. strtoint could not make use of an input string longer than 256 characters anyway, because the output integer could not have more than 19 digits anyway.. so an input string longer than this would be useless… just convert to a shortstrin

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread James Richters via fpc-pascal
A new function that works with other types of strings would simply need to be called something else, and not use the val function at all then it would interfere with nothing. James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://li

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread DougC via fpc-pascal
So, are you saying the one cannot declare an IntToStr function with the string represented by a PChar argument? Seems pretty straightforward to me. Isn't that what is being requested? Doug C. On Wed, 12 Jan 2022 11:10:57 -0500 Sven Barth via fpc-pascal wrote DougC via f

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Sven Barth via fpc-pascal
DougC via fpc-pascal schrieb am Mi., 12. Jan. 2022, 15:20: > Alexey- > > You can always create such a function yourself, gain experience using it, > and share the source with us. That way others can gain experience with it > and maybe someday also ask for it to be added to the standard library.

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread DougC via fpc-pascal
Alexey- You can always create such a function yourself,  gain experience using it, and share the source with us. That way others can gain experience with it and maybe someday also ask for it to be added to the standard library. Doug C. On Tue, 11 Jan 2022 10:46:24 -0500 Alexey T

Re: [fpc-pascal] StrToInt is using ShortString buffer?

2022-01-12 Thread Michael Van Canneyt via fpc-pascal
On Tue, 11 Jan 2022, Alexey Tor. via fpc-pascal wrote: Hello. As I see in the commit https://gitlab.com/freepascal.org/fpc/source/-/commit/beecbf1581a986f544fde77aa428e05c21a35f6f StrToInt always uses ShortString buffer: *Function fpc_Val_SInt_ShortStr(DestSize: SizeInt; Const S: ShortStrin