[fpc-pascal] StrToInt is using ShortString buffer?

Michael Van Canneyt michael at freepascal.org
Wed Jan 12 15:13:24 CET 2022



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: ShortString; out 
> Code: ValSInt): ValSInt;*
>
> If it is correct: Can we skip using ShortString buffer and have e.g. 'common' 
> PChar base function for AnsiString/ShortString?

It's not that easy.

>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.

Michael.


More information about the fpc-pascal mailing list