[fpc-devel] Strange Problem!

Ralf A. Quint FreeDOS at gmx.net
Wed Apr 25 22:37:47 CEST 2012


At 01:11 PM 4/25/2012, Amir wrote:

>I am not sure what you mean be "your program is not valid". I am 
>initializing Result. Modify its content and ...
>
>I already observed that if I use either shortstring or use indices 
>to modify Result, this problem does not occur. But still I can't see 
>what causes this problem. And I believe it is a bug, isn't it?

Yes, a bug in your code. You never set the length of the result 
string anywhere.

Try to initialize the local string with

Result:= 'xxxxxxxxxxxxxxxx'

and then call your function with

WriteLn (MyIntToStr (11111));
WriteLn (MyIntToStr (2222));
WriteLn (MyIntToStr (333));
WriteLn (MyIntToStr (44));
WriteLn (MyIntToStr (5));

and see what happens...

Ralf




More information about the fpc-devel mailing list