[fpc-pascal] How to get the offset of a record

Rainer Stratmann RainerStratmann at t-online.de
Sat Apr 30 15:20:00 CEST 2011


Am Saturday 30 April 2011 15:16:08 schrieb Jonas Maebe:
> On 30 Apr 2011, at 14:30, Rainer Stratmann wrote:
> > In Turbopascal it was possible with offs()
> >
> > type
> > rectype = record
> >  var1 : longint;
> >  var2 : longint;
> >  var3 : boolean;
> > end;
> >
> > var
> > o : longint;
> > recvar : rectype;
> >
> > o := offs( recvar.var1 );  // --> 0
>
> That's incorrect. In TP, Ofs(recvar.var1) (with one "f") returns the offset
> in the segment that contains the "recvar" variable. It does not return the
> relative offset of the field inside the record type.

That are 2 different things.

There was a function which gives the relative offset of the field I am very 
sure of that. And I am very sure that it was offs (wich 2 "f").

>
> Jonas_______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal





More information about the fpc-pascal mailing list