[fpc-devel] Capturing addresses
Marco Borsari
borsa77 at libero.it
Sun Nov 10 16:48:51 CET 2019
Il 10/11/2019 14:36, Jonas Maebe ha scritto:
> Hi,
>
> Does anyone know what the accepted/excepted behaviour is regarding the
> capture of addresses of var/out/const-by-address/constref parameters?
>
> For example:
>
> var
> g: longint;
> p: plongint;
>
> procedure test(var l: longint);
> begin
> p:=@l;
> end;
>
> begin
> test(g);
> end.
>
> The question is: should the compiler by default assume that such
> addresses are not captured, or that they are captured? Does anyone know
> if a lot of code exists that does this?
To me p:=@l should be simply refused by the compiler as it happens in
case of p:=l.
Marco
More information about the fpc-devel
mailing list