[fpc-pascal] Pointer question

Hairy Pixels genericptr at gmail.com
Fri Aug 11 05:12:52 CEST 2023



> On Aug 10, 2023, at 4:23 PM, Hairy Pixels <genericptr at gmail.com> wrote:
> 
> // 4) subscript (inc and dereference in one step)
> v := i[1];
> 
> 
> #4 was not  in the list for example so I wonder what others exist.

I found another one in the typinfo.pp unit. What does,

1) taking the address of a type (@TAlignCheck) yield and 
2) what does dereferencing nil yield?

Both I've never seen before until now.

type
 TAlignCheck = record
   b : byte;
   w : word;
 end;
var
 p: pointer;
begin
 p := @TAlignCheck(nil^).w;
end;

Regards,
Ryan Joseph



More information about the fpc-pascal mailing list