Delphi XE8 的移动编译器中哪些与指针相关的东西不起作用?

What pointer-related things don't work in Delphi XE8's mobile compilers?

Embarcadero 的 docwiki 页面 LLVM-based Delphi Compilers 列出了 Delphi XE8 中的几个语言变化。其中一个项目符号说:

Use of pointers is not supported by LLVM-based Delphi compilers.

这在实践中究竟意味着什么?哪些与指针相关的东西曾经在 Delphi XE7 中工作,在 Delphi XE8 中不再工作?我似乎无法在 Embarcadero 的网站上找到对此的深入解释。据说包含更多信息的页面 Migrating Delphi Code to Mobile from Desktop 没有提到单词 "Pointer",例如。

Use of pointers is not supported by LLVM-based Delphi compilers.

这一定是文档中的错误。只需看一下 RTL。使用指针很厚。

比如CompareMem怎么样。它是这样定义的:

function CompareMem(P1, P2: Pointer; Length: Integer): Boolean;

实现是这样运行的:

function CompareMem(P1, P2: Pointer; Length: Integer): Boolean;
{$IF defined(POSIX)}
begin
  if Length <= 0 then
    Result := True
  else
    Result := memcmp(P1^, P2^, Length) = 0;
end;
{$ELSEIF defined(PUREPASCAL)}
....
{$ENDIF !PUREPASCAL}

移动目标使用了 POSIX 代码。

或者 TObject 看起来像这样:

type
  TObject = class
  public
    constructor Create;
    procedure Free;
    procedure DisposeOf; {$IFNDEF AUTOREFCOUNT} inline; {$ENDIF}
    class function InitInstance(Instance: Pointer): TObject {$IFDEF AUTOREFCOUNT} unsafe {$ENDIF};
    procedure CleanupInstance;
    function ClassType: TClass; inline;
    class function ClassName: string;
    class function ClassNameIs(const Name: string): Boolean;
    class function ClassParent: TClass;
    class function ClassInfo: Pointer; inline;
    class function InstanceSize: Integer; inline;
    class function InheritsFrom(AClass: TClass): Boolean;
    class function MethodAddress(const Name: _ShortStr): Pointer; overload;
    class function MethodAddress(const Name: string): Pointer; overload;
    class function MethodName(Address: Pointer): string;
    class function QualifiedClassName: string;
    function FieldAddress(const Name: _ShortStr): Pointer; overload;
    function FieldAddress(const Name: string): Pointer; overload;
    function GetInterface(const IID: TGUID; out Obj): Boolean;
    class function GetInterfaceEntry(const IID: TGUID): PInterfaceEntry;
    class function GetInterfaceTable: PInterfaceTable;
    class function UnitName: string;
    class function UnitScope: string;
{$IFDEF AUTOREFCOUNT}
    function __ObjAddRef: Integer; virtual;
    function __ObjRelease: Integer; virtual;
{$ENDIF}
    function Equals(Obj: TObject): Boolean; virtual;
    function GetHashCode: Integer; virtual;
    function ToString: string; virtual;
    function SafeCallException(ExceptObject: TObject;
      ExceptAddr: Pointer): HResult; virtual;
    procedure AfterConstruction; virtual;
    procedure BeforeDestruction; virtual;
    procedure Dispatch(var Message); virtual;
    procedure DefaultHandler(var Message); virtual;
    class function NewInstance: TObject {$IFDEF AUTOREFCOUNT} unsafe {$ENDIF}; virtual;
    procedure FreeInstance; virtual;
{$IFDEF AUTOREFCOUNT}
  protected
{$ENDIF}
    destructor Destroy; virtual;

{$IFDEF CPP_ABI_SUPPORT}
    procedure CPP_ABI_1; virtual;
    procedure CPP_ABI_2; virtual;
    procedure CPP_ABI_3; virtual;
{$ENDIF !CPP_ABI_SUPPORT}

  protected
    function GetDisposed: Boolean; inline;
    procedure CheckDisposed; {$IFNDEF AUTOREFCOUNT} inline; {$ENDIF}

{$IFDEF AUTOREFCOUNT}
  private const
    objDestroyingFlag = Integer(000000);
    objDisposedFlag = Integer(000000);
  protected
    [Volatile] FRefCount: Integer;
    class procedure __MarkDestroying(const Obj); static; inline;
    class function __SetDisposed(const Obj): Boolean; static; inline;
  public
    property RefCount: Integer read FRefCount;
{$ENDIF}
    property Disposed: Boolean read GetDisposed;
  end;

很明显,在移动平台上这里使用的是指针。

阅读有关该主题的 Embarcadero 白皮书:The Delphi Language for Mobile Development。它再次涵盖了指针在多种情况下的使用,并且很明显它们是受支持的。现在,不鼓励使用指针也是事实,如果可以很容易地避免使用指针,那么我们鼓励您这样做。但这与声明编译器不支持指针完全不同。

Embarcadero 正在散布对他们自己产品的 FUD,这似乎至少有点讽刺意味。