When does Delphi honor `inline` and when not?
问题 I was tying to optimize a piece of code that has this construct: while (i > 0) do begin Dec(i); This looks inefficient, so I tried to do this: while (Dec(i) >= 0) do begin That doesn't work because Dec is a procedure and not a function. So I rewrite it to: procedure Withloop; var .... function Decr(var a: integer): integer; inline; begin Dec(a); Result:= a; end; ... while (Decr(i) >= 0) do begin But this gets compiled into: SDIMAIN.pas.448: while (Decr(i) >= 0) do begin 00468EE5 8BC4 mov eax