Forum > General

Mobjfpc and Mdelphi incompatibility

(1/1)

airpas:
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: ---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. 

--- End code ---


thanks

taazz:

--- Code: ---PlongArray(map)^[1] := $ffff;
--- End code ---

airpas:
thanks taazz

Leledumbo:
http://www.freepascal.org/docs-html/prog/progsu106.html

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

Navigation

[0] Message Index

Go to full version