Modifying string length?_(re)
Wed, 30 Apr 1997 02:52:45 +0200
> 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
Frank Heckenbach (heckenb@mi.uni-erlangen.de)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es