[fpc-devel] SetLength() vs := ''

Daniël Mantione daniel.mantione at freepascal.org
Fri Nov 9 11:50:33 CET 2007



Op Fri, 9 Nov 2007, schreef Graeme Geldenhuys:

> Hi,
> 
> Is SetLength(StringVar, 0);       faster than     StringVar := '';       ?
> 
> 
> I see quite a bit of code in fpdoc use SetLength() rather than := ''
> so I just wondered...

As far as I know the compiler has code to detect :='' and optimize it. So 
it should not matter.

Daniël


More information about the fpc-devel mailing list