Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.475 Beiträge
Delphi 12 Athens
|
AW: Größe von SETs festlegen
3. Mär 2024, 10:10
Delphi-Quellcode:
type
TEnum = (one, two);
TEnums = set of TEnum;
type
TWindowsEnums = record
class operator Implicit(A: TEnums): TWindowsEnums; overload;
case Integer of
0: (Enums: TEnums);
1: (Fake: set of 0..31);
end;
class operator TWindowsEnums.Implicit(A: TEnums): TWindowsEnums;
begin
Result.Fake := [];
Result.Enums := A;
end;
procedure MyWindowsProc(Par: TWindowsEnums);
begin
Write('TWindowsEnums: ');
var sep := '(';
for var enum in Par.Fake do begin
Write(sep, enum);
sep := ',';
end;
Writeln(')');
end;
procedure Test;
var
Enums: TEnums;
begin
Writeln('Sizeof(TEnum)=', Sizeof(TEnum));
Writeln('Sizeof(TWindowsEnums)=', Sizeof(TWindowsEnums));
Enums := [one, two];
MyWindowsProc(Enums);
end;
|