function ErrorCompilingThis(const StringParam:string; out LongwordParam:longword):boolean;
begin
//Error at the following line: Call by var for arg no. 2 has to match exactly: Got "LongWord" expected "LongInt"
result:=TryStrToInt(StringParam,LongwordParam);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
LW1,LW2:LongWord;
begin
LW1:=LongWord(not(0));LW2:=0;
//Obviously, same error in the following line
if TryStrToInt(IntToStr(LW1),LW2) THEN
if LW1=LW2 then Form1.Caption:='OK';
end;
Now I see there is a TryStrToDWord function, probably it existed even at the time I've written my own TryStrToLongword. Totally counter-intuitive names in the rtl, really.
Nowadays we have a generic function name TryStrToInt that supports multiple types of strings but when it comes to the integer parameter we're stuck with the longint one. In addition to this function name we have a dozen other functions but with precise names that do the same kind of thing as TryStrToInt and that support the same multiple types of strings but only one type of integer: TryStrToInt64, TryStrToQWord, TryStrToUInt64, TryStrToDWord and who knows how many others. If the function name has to identify the second parameter then TryStrToInt doesn't identify the LongInt parameter, it confuzes people into thinking that it's a function that applies to all sorts of integers like it applies to all sorts of strings.
I've given the TryStrToFloat example, here is another one:
TryStrToBool(const S: string; out Value: Boolean) : Boolean;
TryStrToBool(const S: string; out Value: Boolean; const FormatSettings: TFormatSettings) : Boolean;
The rtl doesn't have a TryStrToBool(const S: string; out Value:
BYTEBOOL) : Boolean; declaration, neither a TryStrTo
LONGBOOL(const S: string; out Value:
LONGBOOL) : Boolean declaration.
Probably due to historical reasons we have a function with a generic name that should cover many types of strings and integers, but it doesn't. At least I've been mislead by the name.