Einzelnen Beitrag anzeigen

Rollo62

Registriert seit: 15. Mär 2007
3.930 Beiträge
 
Delphi 12 Athens
 
#2

AW: "strong alias" / "weak alias"?

  Alt 24. Feb 2024, 09:56
Ich denke, es geht nur um die internen Delphi-Typen, wie NativeInt, welche sich beim overload jetzt anders verhalten.
Der NativeIn verändert seinen Typ, je nach Plattform mal Int32 oder Int64, dies hat einige Probleme erzeugt.

Früher war der overload so möglich, jetzt nicht mehr.

Zitat:
You can use it instead of the two counterparts, not in parallel. You can no longer overload like this in Delphi:
Delphi-Quellcode:
procedure doIt( I : Integer ); overload;
procedure doIt( I : Int64 ); overload;
procedure doIt( I : NativeInt ); overload; // Error 120 nativeint      it’s a redeclaration.
Zitat:
Now must either do this if you want distinct behaviors on how to handle 32-bit vs. 64-bit integers:
Delphi-Quellcode:
procedure doIt( I : Integer ); overload;
procedure doIt( I : Int64 ); overload;
Zitat:
Or just write a single version that adapts to the specific platform bittness:
procedure doIt( I : NativeInt ); overload;
  Mit Zitat antworten Zitat