[Lazarus] Delphi mode syntax error

Alexander Klenin klenin at gmail.com
Wed Jan 20 12:48:22 CET 2010


On Tue, Jan 19, 2010 at 20:14, Roland Turcan <konf at rotursoft.sk> wrote:
> Hello all,
>
> I use Delphi style of programing in Lazarus to keep a compatibility
> with Kylix and therefore I want to get this code which is valid of
> Freepascal's ObjectPascal, but in {$MODE Delphi} it doesn't accept
> calling of "MyItems[index]" and writes "Array type required".
>
> How to adapt this code to be valid for Delphi mode.
>
> TYPE
>  PtrUInt = DWord;
>  TMyObj  = PtrUInt;
>  PMyObj  = ^TMyObj;
>  TArr    = ARRAY OF TMyObj;
>
> procedure TForm1.FormCreate(Sender: TObject);
> VAR MyItems         :PMyObj;
[skip]
>
>  ShowMessage (IntToStr (MyItems[0]));
> end;

This should not compile, since pointer is not an array in Pascal.
Delphi does not accept this code too.

-- 
Alexander S. Klenin




More information about the Lazarus mailing list