I would say: GPC *does* optimize this. Just type `gpc -O -S foo.pas' and look at `foo.s' ...
Hmmm... well, I could not see the effect. I wrote the following test program:
program x; var s:string[10000]; begin s:=''; s:=s+'a' end.
I compiled it with "-O3 -S". The resulting code contained two calls to _memcpy. Another test program that appended characters in a loop obviously ran in O(n^2). Am I missing something? -- Frank Heckenbach, Erlangen, Germany heckenb@mi.uni-erlangen.de Turbo Pascal: http://www.mi.uni-erlangen.de/~heckenb/programs.htm Internet links: http://www.mi.uni-erlangen.de/~heckenb/links.htm