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

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Feb 21 17:47:04 CET 2011


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 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


More information about the fpc-pascal mailing list