Originally Posted by
chronozphere
I think this is disturbing. In the second case, it's not possible to set the value of P by using PP^, because it dereferences 2 times at once.
Is there a way to do that?
Cast the typed Pointer to a Pointer and evrything is wonderful.
Code:
var
P: PMyRec;
AnotherP: PMyRec;
PP: PPMyRec;
// PPP: PPPMyRec;
// PPPP: PPPPMyRec;
begin
New(P);
P^.Str := 'test';
P^.Int := 5;
New(AnotherP);
AnotherP.Str := 'AnotherTest';
AnotherP.Int := 6;
PP := @P;
// PPP := @PP;
// PPPP := @PPP;
ShowMessage(P.Str);
Dispose(P);
Pointer(PP^) := AnotherP;
ShowMessage(P.Str);
Dispose(AnotherP);
end;
Originally Posted by
chronozphere
Is it actually possible that PPPMyRec is automaticly dereferenced or does it only do second-degree pointers?
i dunno, but normaly i always notice if something is going wrong.
Bookmarks