[fpc-pascal]Another pointer related question

James_Wilson at i2.com James_Wilson at i2.com
Mon Oct 22 16:41:16 CEST 2001


The recent pointer thread has sparked my memory about another pointer 
related issue that I've come upon. It's probably something I'm doing 
wrong, or a lack of understanding on my point, but here goes anyway...

I have a program that uses pointers in a number of different places for 
various things. Some are straight pointers while others are pointers to a 
record type. I'm trying to make one generic pointer "disposal" routine for 
the all (as opposed to having separate procedures for each different type 
of pointer). I thought it should be fairly easy, but I guess it's not (for 
me anyway  :-)

I created the following Win32/GO32 procedure but the compiler doesn't seem 
to like it. Is there something obvious that I'm doing wrong here?

TIA...

Jim


Procedure ReleaseMemory (PointerName : pointer; Index : longint);

begin

  if PointerName [Index] <> NIL then
  begin
    dispose (PointerName [Index]);
    PointerName [Index] := NIL;
  end;

end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20011022/b0591f30/attachment.html>


More information about the fpc-pascal mailing list