Wednesday, June 20, 2007

Re: pointers are unique?

Many thanks Saurabh,

actually you are right, that's exactly what I meant. I think I agree
with your points...

I am building a network simulator and created a directional graph and
initially I was using the pointers as IDs. But now I expand the
simulator with dynamic insertion and deletion of nodes. This means
that a new node may take the same memory space as an old deleted one.
In this case, not updated pointers from other nodes to the old one
will actually point to the new node. If no new node is inserted in the
same memory space then these pointers will be broken, right?

That was the problem that generated the question.

Many thanks again,
--George

On Jun 20, 11:54 am, "Saurabh Saha" <saurs...@gmail.com> wrote:
> Hi George
>
> When u talk about deleting a memory address what exactly do u actually
> mean-It does not mean u delete any memory area but rather it means that u
> free portion of d dynamic memory which was allocated to the object at
> runtime so I believe there is of course a possibility that the same memory
> area can be taken up by another object unless of course the developer
> forgets to de allocate the memory allocated thus resulting in a memory leak.
>
> So talking about delete from the OS point of view does not quite mean that
> whatever u delete from th UI is actually deleted but rather that the
> reference entity pointing to d memory area gets allocated 2 Null permanently
> and hence cannot point to d memory area it was earlier pointing to.
>
> Correct me if i am wrong guys,.
>
> Regards
> Saurabh
>
> On 6/20/07, gexarchakos <gexarcha...@gmail.com> wrote:
>
>
>
> > Hello everyone,
>
> > just a question on pointers:
> > Assume that you dynamically allocate memory for an object. Sometime
> > later, you dynamically delete it...
> > Is there a possibility that another dynamically created object will
> > take the same memory address as one previously deleted? In that case,
> > pointers cannot work as IDs of objects, right?
>
> > To me it makes sense if there is such a possibility. I'd like your
> > opinion...
>
> > Thanks,
> > -- George


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

<< Home