Jonas Maebe wrote:
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.
But in at least some cases Ofs() was normalised to always contain 0..15,
so it would be easy to (mis)interpret it as an offset into an allocated
block.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal