Marc Weustink wrote:

You are casting a pointer as a string... The way to convert PChar to a
string is to use the function StrPas

Only if you use shortstrings. When using ansistrings you can cast a PChar in to a string like: String(SomePchar)
With ansistrings you seldom (or never) need StrPas


What about the length that is stored just before the memory location of ansistrings? Does PChar created with StrAlloc have this field?

It is not really a cast. The compiler adds conversion code.

I'm interested in this since currently i use StrPas to convert from PChar to AnsiString.

Is this (String(PChar)) faster than StrPas?

Is safe that will not change to a simple pointer cast in future?

Does it copy the string content?

Luiz

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

Reply via email to