> Yes and no. Why is it so bad to write a function in that way ? It could > of course be written two different ways, but I'd rather this way where I > modify the string passed to the function. > > Explain it to me :) (I'm the only one that works on this project of > ~30,000 LOC, so I don't see any problem)
Turbo Pascal and Delphi 1 had a type called 'String'. This was limited to 255 chars, size of 256 chars, and position 0 holds the strings length. Delphi 2+ has a type called shortstring that behaves in exactly the same way as the old style string. Delphi 2+ altered the string type to be a pointer to a chunk of memory, and added a whole load of compiler magic to make strings automatically grow and shrink, added reference counting and 'copy of change' functionality (the last two to aid in not having to copy a string until someone alters it.) This is where your problem lies. Because FPC mimics Delphi string functionality, basically you'll end up with similar results. You'd be much better off Returning a value, and thereby avoiding the potential for big allocation/deallocations. That or use shortstrings. Matt _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal