I have the following codes:
procedure p1(const s:string);
var i,l:integer;
function skip:boolean; //inline not possible
begin
while (i<=l) and (s[i]<=' ') do inc(i);
result:=i<=l;
end;
begin
//skip() is VERY often called here
end;
procedure p2(const s:string);
function skip(const s:string;var i:integer;l:integer):boolean;inline;
begin
while (i<=l) and (s[i]<=' ') do inc(i);
result:=i<=l;
end;
var i,l:integer;
begin
//skip(s,i,l) is VERY often called here
end;
Which one would you prefer? The first one is better readable, but slower, because skip() cannot be inlined. The second one is faster, but very ugly, because every time all the parameters must be specified. Do you know another good readable and fast solution?
iandlare locals, but toskipthey are globals.