Alexandrov Alexandru wrote:
Instead of Math unit, better add a function:

function min(i,j: integer): integer;
begin
 Result := i;
 if j<i then Result := j;
end;

- it is more likely the Math.Min function is optimized (e.g. asmed, inlined)
- it is most likely the IDE already uses the Math unit somewhere

My conclusion: use Math.Min here.

For other projects, adding a Min function might be desirable sometimes if you 
want to keep the executable size small, but be aware that the math unit is 
already included in quite some units. In that case, if you'd include your own 
Min/Max function in your code, you could even end up having two such functions 
in your executable if some other unit in your project uses Math.Min. Finally, 
there is still smartlinking!

Regards,

Bram

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to