Delphi - E2010 Incompatible types: 'Integer' and 'Char' - Any ideas
Posted
by
zeencat
on Stack Overflow
See other posts from Stack Overflow
or by zeencat
Published on 2012-04-13T17:05:42Z
Indexed on
2012/04/13
17:30 UTC
Read the original article
Hit count: 799
I've been tasked with porting a legacy Delphi application over to C# .Net. The original delphi developer left several months before I was hired. I'm receiving the E2010 Incompatible types: 'Integer' and 'Char' error for the below method. I'm trying to compile the application within the Delphi 2007 IDE, I've been told that original application is either Delphi 4 or 5 if that helps any. I understand what the error is telling me but I don't understand why\how it is applied to the code snippet below. Any help\direction would be greatly appreciated.
Thanks in advance
function StrIComp_JOH_PAS_1(const Str1, Str2: PChar): Integer;
var
Ch1, Ch2 : Char;
Offset : Integer;
PStr : PChar;
begin;
PStr := Str1;
Offset := Str2 - PStr;
repeat
Ch1 := Upper[PStr^];
Ch2 := Upper[PStr[Offset]];
if (Ch1 = #0) or (Ch1 <> Ch2) then
Break;
Inc(PStr);
until False;
Result := Integer(Ch1) - Integer(Ch2);
end;
© Stack Overflow or respective owner