How to configure code created for WINx86 to compile for WINx64

I used the assignment of the value of the Component Tag (NativeInt), adding it to the byte set. The program worked correctly when compiling for WIN32, but does not compile for WINx64. (Error 2001 Requires standard type) Here is the MCVE:

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils, System.Classes;
  var 
  S:set of byte;
  C:TComponent;

begin
   C:=TComponent.Create(nil);
   C.Tag:=1;
   s:=[C.Tag];
   C.Free;
 end.

How to configure code to match compilation WINx64?

+4
source share
2 answers

Tag NativeInt. 32 x86 64 x64. , 32- , 64 . , , Integer , Int64 - , . , , , Int64 x86 1, 2 4 .

, , , - , , Integer:

s := [Integer(C.Tag)];

8- , , , Byte:

s := [Byte(C.Tag)];

, :

Assert((C.Tag >= low(Byte)) and (C.Tag <= high(Byte)))

, , , Tag . , , , . , , Tag - , . , NatoiveInt, , , .

+8

, :

s:=[Byte(C.Tag)];

Win32, , Win64 .

​​ Win64, , .

+7

Source: https://habr.com/ru/post/1613713/


All Articles