[fpc-pascal] "Address of" question

Michael Van Canneyt michael at freepascal.org
Sun Jan 14 11:09:50 CET 2024



On Sun, 14 Jan 2024, Hairy Pixels via fpc-pascal wrote:

> I just noticed it's possible to do @Byte in FPC. Are these 2 lines even different? It doesn't exactly make sense to take the address of a type identifier so I'm curious what this may mean.
>
> var
>  b: Byte;
>  p: PByte;
> begin
>  p := @Byte(b);

This is a typecast of b from which you take the address. The typecast is superfluous.

p:=@b

will have the same effect.

Michael.


More information about the fpc-pascal mailing list