For strings, pass them in as const.  That will give a minor performance boost.

For objects, pass them in as var if you need to change the pointer.  I don't 
think I have ever done this myself but there may be a good reason somewhere.
Const or by value won't make any real difference as you are just passing a 
reference.  Even if you pass it as const, you can still change the contents of 
the object.

For records, I think you would be best off passing as const.


Regards

Sean Cross
CIO
Catalyst Risk Management

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stewart, James
Sent: Wednesday, 2 July 2008 3:03 a.m.
To: [email protected]
Subject: Proper way to pass components as parameters?

This is more of a general question than a question concerning a problem.

What do you all consider the best way to pass components (TDataSet,
TTabControl, etc) as parameters to a function or procedure call?

VAR, CONST, or by Value?  Which would give better execution speed or
memory managent?  Is one way of passing the parameters better than
another?

Thanks

James

James D. Stewart
Senior Systems Analyst

Carlson Wagonlit Travel | SatoTravel
4601 N. Fairfax Drive. Suite 170
Arlington, VA 22203

Email: [EMAIL PROTECTED]
Phone: 703-276-2046
Fax:   703-276-2052


_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to