> On Jun 21, 2018, at 10:08 PM, Sven Barth via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> For more questions you can start a thread in fpc-devel. That's the purpose of 
> that mailing list after all. 
> 

Thanks, I’ll post there tomorrow about the technical stuff.

At first glance unless I totally underestimate something it appears to be a 
trivial extension to the define:= syntax but admittedly it’s edge case stuff 
and probably not widely used.

I did a search and found only a few hits on the topic. Since I’ve been giving 
theoretical examples here’s something more practical a user attempted. Can you 
do that without macros? If I had to guess he had some funky code and just 
wanted to reduce typing and copy/paste bugs.

{$define HOFFSET(rec,field) := pointer(@rec.field) - pointer(@rec)} 

type 
        s1_t = record 
                a: longint; 
                b: single; 
                c: double; 
        end; 
var 
        s1: s1_t; 
BEGIN 
        s1.a := 12345; 
        s1.b := 1.000000001; 
        s1.c := 1.000000002; 

        writeln(HOFFSET(s1, a));
END. 

Regards,
        Ryan Joseph

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

Reply via email to