Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-11

SetLength() vs := ''

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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...

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 7 lines
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...

fpdoc was implemented in a time that ansistrings were still buggy. That's why setlength was used.

Michael.

Reply by email