Recent

Author Topic: Mobjfpc and Mdelphi incompatibility  (Read 3212 times)

airpas

  • Full Member
  • ***
  • Posts: 179
Mobjfpc and Mdelphi incompatibility
« 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

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Mobjfpc and Mdelphi incompatibility
« Reply #1 on: May 13, 2014, 07:35:34 pm »
Code: [Select]
PlongArray(map)^[1] := $ffff;
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

airpas

  • Full Member
  • ***
  • Posts: 179
Re: Mobjfpc and Mdelphi incompatibility
« Reply #2 on: May 13, 2014, 10:43:17 pm »
thanks taazz

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Mobjfpc and Mdelphi incompatibility
« Reply #3 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.

 

TinyPortal © 2005-2018