>
> On Wed, 1 Mar 2006, L505 wrote:
>
> > > > Widestrings need to be like that for compatibility with c and c++
> >
> > > Not exactly, they need to be like this because the dang MS COM.
> > > However I can't see why is this different than the AnsiString vs
> > > Windows PChar-based API...
> >
> >
> > I'm off topic here but:
> > I think there should be a standard reference counting mechanism (standards
> > comittee?) between language. We have the standard ansi string header
embedded in
> > the ansistring but no standard reference counting mechanism. If this was the
> > case we could share our ansi strings in DLL's with C++ and other languages.
>
> Ansistrings are unique to Object Pascal. The implementation of strings in C++
> is completely different.
>
> > However There are good reasons for using pchars especially during string
> > concatenations - ansistrings are dead slow when you are making tons of small
> > concatenations.
>
> Sorry, but that is total nonsense. Not more than 'naive' pchars.
>

My strloadfile benchmark proves that the standard programmer using simple
concatenations with ansistrings will have a serious speed problem in his
application.

Unless you have in depth knowledge about how every bit of ansistring memory
management works, using getmem and freemem and pchars are simpler, no? Because
you are not battling the automatic memory management. Now, if you are an expert
in battling the automatic memory management maybe you can battle ansistrings
enough to be almost or just as fast as pchars. Is this what we are doing in the
fpc sources? I will have to look, and see.

Does it require some simple setlength calls or is it more complex than that?
Does it require less or more lines of code than simply using getmem and freemem?
I bet you end up inserting lots more lines of code to battle the memory manager
instead of just manually taking control of it yourself.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to