[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.programming

I want to ask a question...

Ramine

8/7/2015 9:49:00 PM


Hello,


I want to ask a question...


Suppose that you are using a pointer that points to an allocated chunk
of memory, and suppose that you deallocated this chunk of memory and
you have keeped the old address of this pointer inside another pointer ,
is there a problem to access the old address of the pointer and content
of the memory even if it was deallocated ?

I am experimenting with that inside FreePascal compiler and
it doesn't give a problem.. can you confirm that there is or
there is no problem ?


Thank you,
Amine Moulay Ramdane.
1 Answer

Ramine

8/7/2015 10:06:00 PM

0


Hello,

I have just received an answer from Gareth Owen from the
comp.lang.c forum:

Here it is:

"You can access the pointer itself, but you can't access the memory it
points to. Sometimes it might work - and it simple programs it probably
will work more ofhen than not - but you can't rely on it.

Don't do that."



So i will not do that.


Thank you,
Amine Moulay Ramdane.