On 9/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> As a coding practice I would advise specifically declaring all internal
> variables using the <cfset var name=.../> syntax for a object/function that
> is instanated in the application scope. I know in C++ this could be an issue
> since variables may live in the heap space or on the stack. Using this
> syntax means the variable is declared in the stack. Hence, you get a fresh
> copy of the variable with each function call. Otherwise you could create a
> race condition (at least in C++) where two threads are changing the value
> within the function. Again I'm assuming CF / Java works the same way.


Yes, by default should use var in all methods/functions for all private
variables in CF.  The only reason you wouldn't is if you are specifically
attempting to reference a variable outside of the method (which in most
cases you should have passed in anyways).  Encapsulation.

If anyone knows if this is an issue for CF/Java sound off. I suspect it is.
> As far as locking, you most likely would not need to implement locking,
> unless you are modifying a global variable.


Per the CF docs, no locking needed, even for a shared application variable,
unless you are in a race situation.

-Cameron

-- 
Cameron Childress
Sumo Consulting Inc
http://www.sumoc.com
---
cell:  678.637.5072
aim:   cameroncf
email: [EMAIL PROTECTED]



-------------------------------------------------------------
Annual Sponsor FigLeaf Software - http://www.figleaf.com

To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to