Who modified my local variable?

Nicholas Leippe nick at byu.edu
Tue Jun 13 13:38:39 MDT 2006


On Tuesday 13 June 2006 12:47, Bryan Sant wrote:
>
> C++:
>
> void no_leak() {
>   MyObject obj(1, 2, 3);
> }
>
> Local variable.  Allocated on the stack.  Falls out of scope shortly.  No
> leaks.
>
> > How do you statically allocate on the stack a more complicated object
> > that requires several parameters in the constructor?
>
> Java:
>
> void noLeak() {
>   MyObject obj = new MyObject(1, 2, 3);
> }
>
> Local variable.  Sometimes called an automatic variable in Java-terms.


'automatic variable' is also the correct term for the C++ case.

-- 
Respectfully,

Nicholas Leippe
Sales Team Automation, LLC
1335 West 1650 North, Suite C
Springville, UT  84663 +1 801.853.4090
http://www.salesteamautomation.com



More information about the PLUG mailing list