>Date: Fri, 02 Oct 2009 14:18:19 -0400
>To: [email protected]
>From: Rick <[email protected]>
>Subject: Re: [c-prog] class object destruction?
>Bcc: ƒ\01-personalities\[email protected]
>
>At 10/2/2009 01:56 PM, you wrote:
>>Hi Rick,
>>Each time inside the loop, dir object will be created and destroyed.
>>The first instance will not stay around. It will be destroyed when the first
>>iteration of the for loop completes.
>>The dir object is statically created inside the for loop and the life time
>>and scope of such objects will be local to the block where it is created.
>>These objects generally gets created on the stack and will be destroyed
>>automatically when it goes out of scope.
>>The destructor will be called properly during such destruction.
>>In this case for each iteration of the for loop, the constructor and
>>destructor of dir object will be called.
>>
>>I feel this is not the best way of doing it. There are lot of other better
>>ways to do that.
>>If i am not wrong, i would say that the way dir object is modelled was
>>wrong.
>>Instead of creating object every time, it would rather can be created once.
>>It should expose a public interface for processing different
>>directory/files.
>>There are lot of other smart people in this group. I believe they can give
>>you suggestions on better way of designing it.
>>
>>Thanks,
>>Thanga
>
>Thank you for your thoughts.
>
>Initially I put the directory and path names 
>into the process() calling list but changed it 
>later. I could put it back the other way. In 
>fact, that may help with another issue I have of 
>maintaining values across instantiations.
>
>~Rick

On second thought, I don't think this will work 
(create only one object). The reason, I now 
remember, that i changed the code was because 
each path that a user specifies becomes a new 
"root" path to search. I recurse through all 
directories from that path down. So I need a "base" point to anchor to.

~Rick


Reply via email to