[c++]automatic vs dynamic storage
From: ed (nocoo_t2spam_at_yahoo.com
Date: 03/13/04
- Next message: Jonas Hansson: "Re: [c++]automatic vs dynamic storage"
- Previous message: Efi Merdler: "Re: Creating an array that each cell points to the next one"
- Next in thread: Jonas Hansson: "Re: [c++]automatic vs dynamic storage"
- Reply: Jonas Hansson: "Re: [c++]automatic vs dynamic storage"
- Reply: Mike Wahler: "Re: [c++]automatic vs dynamic storage"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 13 Mar 2004 21:05:06 GMT
Hi. I was wondering if there are any hard and fast rules to go by
when deciding whether to create an object with automatic storage, or
with dynamic storage.
For instance, I may create an object with automatic storage, in some
function/block
in my program. But that object may be passed around all throughout
the program.
Maybe something like:
int myFunc(void)
{
MyClassName MyObj;
AnotherClass AnotherObj;
MyObj.doSomething(AnotherObj);
// more stuf ......
}
MyObj may pass AnotherObj somewhere else. Is this ok? Or is this a
situation where
you need to use dynamic storage?
I guess what I'm not clear on is, is AnotherObject still considered to
be in the scope
of myFunc, even though it's being passed around to other parts(and
scopes?) of
the program?
tia,
--ed
- Next message: Jonas Hansson: "Re: [c++]automatic vs dynamic storage"
- Previous message: Efi Merdler: "Re: Creating an array that each cell points to the next one"
- Next in thread: Jonas Hansson: "Re: [c++]automatic vs dynamic storage"
- Reply: Jonas Hansson: "Re: [c++]automatic vs dynamic storage"
- Reply: Mike Wahler: "Re: [c++]automatic vs dynamic storage"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]