Lazarus

Free Pascal => General => Topic started by: airpas on May 13, 2014, 07:29:12 pm

Title: Mobjfpc and Mdelphi incompatibility
Post by: airpas on May 13, 2014, 07:29:12 pm
hi
this code compile without error in delphi mode , but raise an error of incompatible type in objfpc mode .
how to get this code work in objfpc mode ?
Code: [Select]
type
    PLongArray = ^TLongArray;
    TlongArray = array[0..1] of longword;
var
   map : ^byte;
begin
   GetMem(map,256*256);
   PlongArray(map)[1] := $ffff; // -Mobjfpc : Error : Incompatible types : got "word" expected "TlongArray"
   FreeMem(map);
end. 


thanks
Title: Re: Mobjfpc and Mdelphi incompatibility
Post by: taazz on May 13, 2014, 07:35:34 pm
Code: [Select]
PlongArray(map)^[1] := $ffff;
Title: Re: Mobjfpc and Mdelphi incompatibility
Post by: airpas on May 13, 2014, 10:43:17 pm
thanks taazz
Title: Re: Mobjfpc and Mdelphi incompatibility
Post by: Leledumbo on May 17, 2014, 06:58:38 am
http://www.freepascal.org/docs-html/prog/progsu106.html

AUTODEREF is active for Delphi and TP mode, for compatibility reason.