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(
Am Saturday 30 April 2011 15:15:21 schrieb Florian Klämpfl:
> > o := PtrUInt( @recvar.var1 ) - PtrUInt( @recvar );
> > o := PtrIUnt( @recvar.var2 ) - PtrUInt( @recvar );
> > o := PtrInUt( @recvar.var3 ) - PtrUInt( @recvar );
>
> Actually even
> o := PtrUInt(@(rectype(nil^).var1)));
> is possible.
.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Jonas Maebe
Envoyé : samedi 30 avril 2011 15:28
À : FPC-Pascal users discussions
Objet : Re: [fpc-pascal] How to get the offset of a record
On 30 Apr 2011, at 15:20, Rainer Stratmann wrote:
> Am Saturday 30 April 201
Am Saturday 30 April 2011 15:28:03 schrieb Jonas Maebe:
> On 30 Apr 2011, at 15:20, Rainer Stratmann wrote:
> > Am Saturday 30 April 2011 15:16:08 schrieb Jonas Maebe:
> >> That's incorrect. In TP, Ofs(recvar.var1) (with one "f") returns the
> >> offset in the segment that contains the "recvar" var
On 30 Apr 2011, at 15:20, Rainer Stratmann wrote:
> Am Saturday 30 April 2011 15:16:08 schrieb Jonas Maebe:
>> 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
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;
> > recva
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
Am Saturday 30 April 2011 14:54:22 schrieb Aleksa Todorovic:
> On Sat, Apr 30, 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 :
> o := PtrUInt( @recvar.var1 ) - PtrUInt( @recvar );
> o := PtrIUnt( @recvar.var2 ) - PtrUInt( @recvar );
> o := PtrInUt( @recvar.var3 ) - PtrUInt( @recvar );
Actually even
o := PtrUInt(@(rectype(nil^).var1)));
is possible.
___
fpc-pascal maillist - fp
On Sat, Apr 30, 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
> o := offs( recv
10 matches
Mail list logo