[fpc-other] Re: [fpc-pascal] Re: Illogical automatic dereferencing
"Vinzent Höfler"
JeLlyFish.software at gmx.net
Tue Oct 13 22:18:21 CEST 2009
Reimar Grabowski <reimgrab at web.de>:
> > If you have "p: PINTEGER" then you're assuming you're accessing to ONE
> > integer.
>
> No, YOU assume that.
And the compiler, too:
-- 8< -- snip --
{$T+} // Typed pointers, or we can assign anything.
type
IntArray = array[0 .. 9] of Integer;
pInteger = ^Integer;
pIntArray = ^IntArray;
var
I : Integer;
A : IntArray;
var
PI : pInteger;
PA : pIntArray;
begin
PI := @I;
PA := @A;
//PI := @A; // Does not work, wrong type.
WriteLn (SizeOf (PI^));
WriteLn (SizeOf (PA^));
end.
-- 8< -- snip --
Output:
2
20
Vinzent.
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the fpc-other
mailing list