[fpc-pascal] assigning ansistring with shortstring

Jonas Maebe jonas.maebe at elis.ugent.be
Fri May 26 19:57:51 CEST 2006

On 26 May 2006, at 19:35, L505 wrote:

>> The length bytes of those shortstrings aren't initialised if you
>> don't do setlength(). It has nothing to do with memory allocation,
>> but with initialisation.
> Learn something new today - I unfortunately don't have a  
> turbopascal background and in
> this case it would really help - I guess I made the silly  
> assumption that shortstrings
> were ready to go without ever needed a setlength.

They are, as long as you use regular string assignments,  
concatenations etc. Otherwise I'm not sure how the compiler/rtl is  
supposed how long your string actually is.


More information about the fpc-pascal mailing list