Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-02

Error: Can't take the address of constant expressions

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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 should I change to get this running on 64bit and get the code still compatible with 32bit compiler as well.

Thanks.

Jonas Maebe
to Roland Turcan
Roland Turcan wrote 18 lines
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 should I change to get this running on 64bit and get the code still compatible with 32bit compiler as well.
Change
 Inc (Cardinal (MyPWord), 2);
into
 Inc (MyPWord);

(note: *without* the "2"; that is implicit because MyPWord points to data items of size 2)

Jonas