Using pointers is not supported by LLVM-based Delphi compilers.
This should be a mistake in the documentation. Just take a look at RTL. It is fat using pointers.
For example, what about CompareMem . It is defined as follows:
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean;
And the implementation is as follows:
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}
The POSIX code is used by mobile targets.
Or what about a TObject that looks like this:
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($80000000); objDisposedFlag = Integer($40000000); 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;
It's pretty clear that pointers are used here on mobile platforms.
Read the Embarcadero white paper on Delphi Mobile Development . Again, this applies to the use of pointers in several cases, and it is clear that they are supported. Now itβs also true that using pointers is discouraged, and if pointers can be easily avoided, then you are advised to do so. But this is not at all how it is indicated that pointers are not supported by compilers.
It seems, at least mildly ironic, that Embarcadero is distributing the FUD of its products.
source share