delphi - What is the difference between Ansichar and char? -
delphi - What is the difference between Ansichar and char? -
this question has reply here:
what difference between widechar , ansichar? 2 answersi ran info type mismatch. never saw before. hope explain these , how different.
error got f2063. [dcc error] e2010 incompatible types: 'ansichar' , 'char'
historically in delphi, char type synonym ansichar type. is, single byte representing character ansi codepage. note: this simplification ignores complications arising multibyte characters encountered in ansi string suffice answer.
this corresponded fact string type synonym ansistring.
in delphi 2009 onward, changed.
with delphi 2009, string , char types became synonyms unicodestring (a widestring additional capabilities) , widechar, respectively, reflecting transition unicode native format string , character types. widechar 2 byte value representing single character of unicode (or 1 half of surrogate pair).
therefore, in versions of delphi prior delphi 2009, next 2 variables of compatible types:
var ach: ansichar; ch: char; // synonymous ansichar
however, in delphi 2009 , later meaning of "ch" declarations changes:
var ach: ansichar; ch: char; // synonymous widechar
as result, ach , ch variables no longer of compatible types.
i.e. reason getting error have code has been declared ansichar types , other code using values declared of type char. when compiled old version of delphi char = ansichar, 2 sets of code compatible, in delphi 2009 , later char = widechar , 2 types (char , ansichar) not compatible.
delphi variables types char widechar
Comments
Post a Comment