[fpc-devel] Concatenating huge AnsiStrings

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jun 21 19:54:30 CEST 2024



On 6/21/24 19:39, Bart via fpc-devel wrote:
> Hi,
> 
> Possibly not a real-world problem, but some pet-project of mine has to
> deal with it (at least in theory).
> 
> What happens if you try to concatenate 2 huge ansistrings, such that
> Length(String 1) + Length(String 2) > High(SizeInt)?
> All this assuming you have memory enough to perform such an operation ;-)

The GetMem or ReAllocMem will fail. So EOutOfMemory.


> Will this trigger some sort of error, or will it silently ditch all
> characters beyond High(SizeInt), like concatenating two long
> shortstrings do if the combined length would be > 255?

Mattias



More information about the fpc-devel mailing list