> On Aug 10, 2023, at 11:37 PM, Michael Van Canneyt via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> This is a very dirty trick to get the offset of a field in a record.
> 
> Note that you're not dereferencing a type but a variable of type TAlignCheck 
> located
> at memory address zero. The address of w (this is what the expression is
> doing) is then the offset of w in the record.
> 
> It's probably more clear if you write it as
> p := @(TAlignCheck(nil^).w);

where is the variable located in this expression? It can't be nil can it?

Sounds like we need a compiler intrinsic to get the field address because that 
syntax is kind of crazy. :)

Regards,
Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to