Re: [fpc-pascal] Error: Can't take the address of constant expressions

2012-09-26 Thread Jonas Maebe
On 26 Sep 2012, at 07:58, Vincent Snijders wrote: > 2012/9/25 Bernd : >> 2012/9/25 patspiper : >>> procedure test; >>> begin >>> Move(MyClass1.Ref.Data^, MyClass2.Ref.Data^, 1); >>> end; >> >> and if you cast it to some other pointer type before dereferencing the >> error goes away: >> >> proc

Re: [fpc-pascal] Error: Can't take the address of constant expressions

2012-09-26 Thread patspiper
On 26/09/12 08:58, Vincent Snijders wrote: 2012/9/25 Bernd: 2012/9/25 patspiper: procedure test; begin Move(MyClass1.Ref.Data^, MyClass2.Ref.Data^, 1); end; and if you cast it to some other pointer type before dereferencing the error goes away: procedure test; begin Move(MyClass1.Ref.Da

Re: [fpc-pascal] Error: Can't take the address of constant expressions

2012-09-25 Thread Vincent Snijders
2012/9/25 Bernd : > 2012/9/25 patspiper : >> procedure test; >> begin >> Move(MyClass1.Ref.Data^, MyClass2.Ref.Data^, 1); >> end; > > and if you cast it to some other pointer type before dereferencing the > error goes away: > > procedure test; > begin > Move(MyClass1.Ref.Data^, PByte(MyClass2.R

Re: [fpc-pascal] Error: Can't take the address of constant expressions

2012-09-25 Thread patspiper
On 25/09/12 20:43, Bernd wrote: 2012/9/25 patspiper : procedure test; begin Move(MyClass1.Ref.Data^, MyClass2.Ref.Data^, 1); end; and if you cast it to some other pointer type before dereferencing the error goes away: procedure test; begin Move(MyClass1.Ref.Data^, PByte(MyClass2.Ref.Data

Re: [fpc-pascal] Error: Can't take the address of constant expressions

2012-09-25 Thread Bernd
2012/9/25 patspiper : > procedure test; > begin > Move(MyClass1.Ref.Data^, MyClass2.Ref.Data^, 1); > end; and if you cast it to some other pointer type before dereferencing the error goes away: procedure test; begin Move(MyClass1.Ref.Data^, PByte(MyClass2.Ref.Data)^, 1); end; But this should

Re: [fpc-pascal] Error: Can't take the address of constant expressions

2012-09-25 Thread Bernd
2012/9/25 patspiper : > Hi, > > Despite > http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields, > shouldn't the following be legal? I tested under FPC 2.6.1 and 2.7.1. This shouldn't even matter here since IMHO it should work even if Ref were a function

[fpc-pascal] Error: Can't take the address of constant expressions

2012-09-25 Thread patspiper
Hi, Despite http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields, shouldn't the following be legal? I tested under FPC 2.6.1 and 2.7.1. TMyRecord = record Data: pointer; end; TMyClass = class private FRef: TMyRecord; public p

Re: [fpc-pascal] Error: Can't take the address of constant expressions

2011-02-21 Thread Jonas Maebe
On 21 Feb 2011, at 16:59, Roland Turcan wrote: > type TMyObj = class > private >MyPWord:PWord; >... > end; > > procedure TMyObj.Some; > begin > ... > Inc (Cardinal (MyPWord), 2); > ... > end; > > and compiler says %subj% > > This cod

[fpc-pascal] Error: Can't take the address of constant expressions

2011-02-21 Thread Roland Turcan
Hello all, I have this code: type TMyObj = class private MyPWord:PWord; ... end; procedure TMyObj.Some; begin ... Inc (Cardinal (MyPWord), 2); ... end; and compiler says %subj% This code works fine on 32bit compiler, but what sh