I also use Global variables. Sometimes it makes life a LOT easier.
BUT a good thing to do, is put a g_ before the name of the variable,
i.e. g_MyGlobalVariable this way you know its a Global variable.

Jeremy Coulter

p.s where I work, our main app. is a VB one (being rewritten in Delphi now
tho) and it uses global variables EVERYWHERE, and with the g_ in the
name,its quite handy to know the variable is global, and easy to remember,
but from a performance point of view, its hard to say whet impact it has, as
VB is slow anyway.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Rohit Gupta
Sent: Wednesday, 2 May 2001 21:45
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Best Practice


I often use global variables inside a unit or inside a component, when the
number of parameters in the procedure is starting to increase.... makes the
code easier to read.

Best to avoid them, partly for the risk of duplicating one - and then the
IDE displays the value of one, half your code uses one and the other half
uses the other.  I keep plaguing Borland to atleast include this as a
compiler warning.


----- Original Message -----
From: "Mark Howard" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Thursday, 3 May 2001 09:54
Subject: [DUG]: Best Practice


Hi

Another Newbie question.

What are the pro's and con's of either
passing a parameter to a procedure
versus
setting a global variable that the procedure can read?

Mark


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to