Difference between PAnsiChar and PChar

后端 未结 5 848
谎友^
谎友^ 2021-02-06 12:17

Is there a difference and what type of between PAnsiChar and PChar? (in Delphi previous 2007)

Thank you, in advance!

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-06 12:20

    I take notice of the "In Delphi previous 2007" in your question, which I take to mean "In Delphi 2007 and earlier", so....

    In Delphi 2007 and previous PChar and PANSIChar are synonymous. They mean the same thing - a pointer to an ANSIChar value. Char is synonymous with ANSIChar in those versions.

    However, in Delphi 2009 and later, Char becomes synonymous with WideChar, so PChar becomes synonymous with PWideChar.

    Note, that a WideChar is NOT a Unicode character - Unicode is simply not that straightforward. Any one WideChar value may be a codepoint in the BMP (Basic Multilingual Plane) or it may be either one of a surrogate-pair. It may also be a diacritical mark - for example an "accent" to be applied to the immediately preceding codepoint in a WideString.

    The concept of a "character" in Unicode does not easily map to a single value of any type.

提交回复
热议问题